Rails inconsistency

I like Ruby on Rails, but the design is sometimes inconsistent.

For example, consider the “text_method” parameter to the collection_select helper method. The argument forces you to call a method on the model object which returns the text which is used in the select list. That’s ok when you only want to display a single field from that object, for example “name”. It’s not ok if you want to display something more complicated, because then you’re putting display logic into the model. You’re supposed to use helpers for that! Since doing it right would make it ugly and more complicated, I end up giving in and doing it the wrong way by adding a method to the model. It frustrates me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.