Intridea Blog: Technology, Design, Business

Back to Blog

Get in Touch

You're currently viewing posts tagged with: "how to"

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…