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
Post a Comment