RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: balexand
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).
Enumerable#sort_by
Nevermind, Rails 4 beta as of today is back to using :child_index.
:child_index
In the current Rails 4 beta, the :child_index option for fields_for doesn't work. Use :index instead.
fields_for
:index
fields = f.fields_for(association, new_object, index: id) do |builder|
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 forfields_for
doesn't work. Use:index
instead.