ruby on rails - How to modify the create & update method in RoR? -


i know after create or update methods done, have method

respond_to |format|   format.js  end 

since change form remote form non remote form, won't use format.js anymore, want refresh page, after user create/update product, have code:

respond_to |format|   page.reload end 

but don't work, try not use respond_to do, have page.reload. show me site this:

http://localhost:3000/products/50 

i want reload page after create/update, why can't in way?

the reload method reloads browser's current location using javascript. suggest want server-side redirect after creating or updating resource. one of these alternatives:

redirect_to product_path(@product) # redirect 'show' page product redirect_to products_path          # redirect products' index page 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -