RailsCasts Pro episodes are now free!

Learn more or hide this

balexand's Profile

GitHub User: balexand

Comments by


Same here. I'll post if I figure something out.


If you store the fields in a serialized Hash like in this episode then there's no convenient way to select/sort by these values using ActiveRecord (but you could sort them in Ruby using Enumerable#sort_by. You should check out Hstore (episode #345).


Nevermind, Rails 4 beta as of today is back to using :child_index.


In the current Rails 4 beta, the :child_index option for fields_for doesn't work. Use :index instead.

fields = f.fields_for(association, new_object, index: id) do |builder|