I’m using Ryan Bates nested_form gem. I’d like to be able to control the ordering that it lists the nested fields in. I have a default_scope that works, but I need more control over this depending on the scenario.
Ideally something like
# In controller action
@nesties = Nesty.order("name desc")
# In view
# If @nesties defined the following line would respect the @nesties ordering
f.fields_for :nesties do |nestie-form|
Right now it will respect the default_scope ordering, but I can’t find any other way to control the ordering.
In the model that has the nesties association:
This may be too global for your app though.
But the fundamental thing is that fields_for doesn’t pick up on @nesties it picks up on association of the parent form’s model.
EDIT: Not sure this would work with the nested_form gem but this solution wouldn’t affect the normal ordering of the nesties association:
then