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
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:
I am using Ruby 2.2.0 and Rails 4.2.3.
Thanks a lot!