I’m trying to create a new EventPlace for an Event record. I have Event set up to accepts_nested_attributes_for :event_places and the following code in my view:
<div id="add_venue_form" style="border:2px solid black; padding: 5px;">
<% form_for @event, :html => {:name => "form2"} do |f| -%>
<% f.fields_for @event_place do |v| -%>
<%= v.text_field :place_id %>
<% end -%>
<a class="button" style="margin-left:10px;margin-top:4px;" href="javascript:document.form2.submit();" onclick="this.blur();"><span>Save</span></a>
<% end -%>
When I add an id number in the field and click the save button, it gives me this error:
Processing EventController#update (for 127.0.0.1 at 2012-05-24 15:43:39) [PUT]
Parameters: {"id"=>"48404", "action"=>"update", "controller"=>"event",
"_method"=>"put", "event"=>{"event_place"=>{"place_id"=>"3"}}}
SQL (0.1ms) SET NAMES UTF8
Redirected to http://localhost:3001/event/list
Filter chain halted as [#<Proc:0x00000001094746e0@/Users/anthonylassiter/.rbenv/versions/ree-1.8.7 2012.02/lib/ruby/gems/1.8/gems/actionpack-2.3.10/lib/action_controller/verification.rb:82>] rendered_or_redirected.
Completed in 8ms (DB: 0) | 302 Found [http://localhost/events/48404]
My update method
def update
@event = Event.find(params[:id])
if @event.update_attributes(params[:event])
redirect_to index
end
end
It looks like the params are correct. It doesn’t seem to even hit my update method on my event_controller, but instead is causing some internal error and trying to redirect to /list which doesn’t exist, but then I shouldn’t need that if Update was working.
Somewhere in your controller (or in one of its superclasses) you’re using
verifyto limit what requests can be made (or a plugin you are using could have called verify). The logged request failed one of those verification steps and so rails redirected it instead.