I'm re-rendering a partial after submitting a remote: true form, but my problem is that it seems to re-render the partial BEFORE fully completing the form's update action. As a result, it renders old data on the page, and shows updated info only after a full refresh (or when I submit the form yet again). Is there a way to force the application to re-render the partial after everything is completed, in order to display only the new info? Or am I missing a step here?
update.js.erb:
$("#methods").html("<%= escape_javascript(render partial: 'methods') %>");
owner_controller.rb
respond_to :html, :js, :json
def update
if owner.update_attributes(owner_params)
respond_to do |format|
format.js
end
else
fail_update
end
end