Hi everybody,
I have the following problem:
My model ‘event’ has many ‘eventdates’. I use a nested form to edit
these events and its eventdates. Everything gets updated using js,
which works fine.
def update
@event = Event.find(params[:id])
respond_to do |format|
if @event.update_attributes(params[:event])
format.html { redirect_to(@event) }
format.js {}
else
format.html { render :action => “edit” }
format.js {}
end
end
end
Again, using ajax it is possible to add another eventdate to the
event.
def add_eventdate
@event = Event.find(params[:id])
@event.eventdates << Eventdate.new
render :partial => "tab2", :object => @event
end
That works fine, too. But updating the model now is reloading the page
or actually it is doing redirect_to(@event). So whenever I have added
a new child to the event-object it is not updating via ajax anymore it
seems.
Could you give me a hint what aspect I am missing?
Thanks a lot