Skip to main content

Posts

Showing posts from May, 2012

Deals You Can't Miss

1 Year Subscription

Agile Tour 2012 - Bangalore, India

Agile Tour 2012 would be my first Agile conference that I'll be speaking this year, very closely followed by Agile By Example 2012 conference in Poland. Because the timing of the said conferences are very close, I shall be speaking on the same topic and it is "How I hated the ceremonial standup and how I ended up enjoying it." If you are around to any of these conferences, feel free to get in touch; we'll talk and share our experience. Thank you ISEC for accepting my proposal!

Agile By Example 2012

I'm glad to announce that... Should you wish to know what I'd be talking about, and what other speakers have to share, do browse Speakers List . See you there...

Rails and StringInquirer - A real world example

Use Case: Assume a User model, having an association with UserProfile model. Also, presume that Admin, Artist, Exhibition Curator, Collector, etc are models that are inherited from UserProfile. Now, if we'd like to know weather a given user is an admin or a collector or of any other profile type, we'll typically have to define methods like below in the User class: We coule simplify the above methods using meta-programming technique to define methods at runtime, using "define_method" method. However, there exists an easier and neater method. It is to employ the delegate and StringInquirer as below: With any of the above implementations, we can test a given user instanse against a specific user profile type as below: user.admin? instead of user.user_profile.type.titleize == "Admin" As a matter of fact, starting Rails 2.3.x, if I'm right, you test for Rails environment with a code like the one below: Rails.env.development? inst