If I have a single page with many forms of existing records:
index.html.haml
- for selection in @selections
- form_for selection, :method => :put do |form|
= form.collection_select :user_id, @current_account.users, :id, :full_name
and then this for submits to and update action:
selections_controller.rb
def update
selection = Selection.find(params[:id])
if selection.update_attributes(params[:selection])
flash[:notice] = "Save!"
redirect_to selections_path
else
flash[:errors] = "Errors"
render :index
end
end
How do I handle error messages if I have these multiple forms on the same page. i.e if I want to use:
selection.errors.on(:user_id)
for one of the forms?