Intridea Blog: Technology, Design, Business

Back to Blog

Get in Touch

You're currently viewing posts tagged with: "metaprogramming"

Implementing DRY Magic Methods in Ruby

By Michael Bleigh | November 16, 2011 ruby, metaprogramming, how to
Medium

As a new developer to Ruby you might wonder how certain methods seem to be magically available without being strictly defined. Rails's dynamic finders (e.g. find_by_name) are one example of this kind of magic. It's very simple to implement magic such as this in Ruby, but it's also easy to implement things in a way that doesn't entirely mesh with standard Ruby object expectations.

Read more…

Twas Brillig, and the Slithy Code...

By Kevin Gisi | May 3, 2011 tips, development, metaprogramming, code, legacy code
Medium

No matter what level of developer you are, at some point you will have the underrated joy of inheriting a legacy software project. And since we're fortunate enough to work in such a fast-paced community and ecosystem, "legacy" really encapsulates any piece of software more than a week or two old. Often though, we don't have time to appreciate how our ancestors used to write Ruby back in the days of Rails 2.3, or even (gasp) 2.1 — we need to get right to work. It's at this point that the nefarious Jabberwocky method can rear its ugly head.

Read more…

ActiveRecord::Base.create_or_update on Steroids