Skip to content Skip to sidebar Skip to footer

Rails - Ajax To For New/create Action

I've got a timeline with events partials on it so that you can CRUD events directly on the timeline page. I've got it working so that you can delete an event, and the delete partia

Solution 1:

The :remote => true option on render :partial in the timelines/show view is not required.

Instead the form_for in _new_event.html.erb should have the options :remote (this makes the form submit via ajax) and :format (this requests the response be in JavaScript), e.g.:

<%= form_for event, :remote => true, :format => :jsdo|f| %>

Post a Comment for "Rails - Ajax To For New/create Action"