I am new to Ruby on Rails and would like to know how I can do to redirect from the% share% action to the% share%.
I would like the page "show.html.erb" to be displayed after saving the article created from the page "new.html.erb" .
I am new to Ruby on Rails and would like to know how I can do to redirect from the% share% action to the% share%.
I would like the page "show.html.erb" to be displayed after saving the article created from the page "new.html.erb" .
To redirect when you finish a create
to show
you have to use:
redirect_to action: :show
or it would also work in your case:
redirect_to flight_path(@flight)
When you need to redirect to show
of an object, you can also do it directly:
redirect_to @flight
Y You can also add a message:
redirect_to @flight, notice: "El vuelo se guardó correctamente."