I have a hidden field in a form_for, where I have it set up like this:
= f.hidden_field :building_id, :value => @building
Where @building is set in the controller in the new action:
@building = params[:building][:building_id]
When validation fails, the create action gets to this line:
format.html { render action: "new" }
and the page is rendered, the hidden_field is not getting it's value.
According to one of the answers to this question, it looks like maybe I should have this line in my form_for:
= f.hidden_field :building_id, params[:building][building_id]
but I get an error when I do this. What am I doing wrong?