RailsCasts Pro episodes are now free!

Learn more or hide this

balexand's Profile

GitHub User: balexand

Comments by

Avatar

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

Avatar

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).

Avatar

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

Avatar

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

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