JangoSteve / remotipart

Rails jQuery file uploads via standard Rails "remote: true" forms.
http://os.alfajango.com/remotipart
Other
1k stars 215 forks source link

Unable to redirect as JS #146

Closed genreil closed 8 years ago

genreil commented 8 years ago

Hi!

After successful completion of update action, I am trying to redirect to show action. However, while the request to update comes as ...Controller#update as JS after redirect to show it becomes an HTML request (...Controller#show as HTML). It means that it is detected as format.html in the code below, while it should be format.js. Is it a known issue? Any advise on how to resolve it?

My redirect:

respond_to do |format|
  if @user.update(user_params)
    format.html { redirect_to @user }
    format.js { redirect_to @user }
  else
    format.html { render :show }
    format.js { render :show }
  end
end

I am using Ruby 2.2.0 and Rails 4.2.3.

Thanks a lot!