What's the best way to pass some params along with a redirect?
I saw examples that said if you just add them to your redirect hash they would pass along with the request, but that doesn't seem to work anymore in Rails 3.
In my example I have an 'edit multiple' page that lets a user change the category on multiple items at once. Because they're browsing so many items this form is paginated.
If a user is on items page 3
, makes some changes and presses sumbit, then the controller action receives a post request with the ids of the records that were changed, makes the changes, and redirects to the edit_many_items_path
.
So, that redirect looks like this:
redirect_to edit_multiple_items_path, :notice => 'items updated'
... but what I'd like it to do is something like:
redirect_to edit_multiple_items_path, :notice => 'items updated', :page => ##
The above code doesn't work, so does anyone have an example of what would?
Try this:
redirect_to(edit_multiple_items_path(:page =>2), :notice => 'items updated')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With