Take me home

First Rails patch

Written by August Lilleaas, published November 21, 2007

Made a rails patch that improves the behavior of some form helper methods. I’m proud!

The syntax of the select helpers is annoying! It is

collection_select(:category_id, @categories, 'id', 'title', {}, :class => "cool")

Two option hashes! Noone likes that, not even Jeremy Kemper (first follow-up). I made my first evah patch, and submitted it!

http://dev.rubyonrails.org/ticket/10233

It lets you:

collection_select(:category_id, @categories, 'id', 'title', :html => {:class => "cool"})

Just like form_for. And it avoids with_options getting screwed up, too.

It’s even backwards compatible, thanks to some haxx *args-parsing.


Questions or comments?

Feel free to contact me on Twitter, @augustl, or e-mail me at august@augustl.com.