Rails, change URL for a POST action within a controller -
i want url changed when call action within controller made. current scenario:
controller:
class eventcontroller < applicationcontroller def index if city.blank? failure end ... end def failure ... render 'failure' end end
routes:
get '/event', to: 'event#index' post '/event/failure' => 'event#failure'
but code keeps url /events. desired result /events/failure
i've views payment 'index' , 'failure'. i'm using rails ~ 5.0.0.
for url change want redirect, :
class eventcontroller < applicationcontroller def index if city.blank? redirect_to action: 'failure' end ... end def failure ... render 'failure' end end
but, redirection not possible post requests given in http/1.1
you might want consider changing strategy.
Comments
Post a Comment