After submitting a remote form with Rails, how do I redirect the user to another page?
问题 I’m using Rails 4.2.3. I want to submit a form in a modal dialog, so I have set up my form like so <%= form_for @my_object, :remote => true do |f| %> but if the user submits the form successfully, I would like to reload the page that invoked the modal dialog with a notice of “Saved Successfully.” I can’t figure out what I need to put in my “format.js” to make this happen. This is what I have in my controller so far … def create @my_object = MyObject.new(my_object_params) @current_user = User