ruby on rails - redirect_to another URL after save -


after creating @page on controller, i'd redirect path equals

/@page.unique 

i.e. /24dds3

i've got 'show' action set it:

def show   @page = page.find_by(unique: params[:id]) end 

but can't figure out how fix redirect @ end of create action

use redirect_to resourcename_path(@object)

more detailed

def create  @object = model.new(params[:values])  if @object.save    redirect_to resourcename_path(@object) else   render 'new' end   end 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -