Use url_options to include the same parameters in all paths of view, controller.
#application_controller.rb
def url_options
{ first: "first", last: "last"}
end
I did it like this, but
redirect_to user_path(name: "aaa")
gives parameters, whereas
redirect_to user_path
The url_options parameter is not included only if you do not have any arguments.
(url_options itself does not pass)
When I looked at the website that showed how to use url_options, I couldn't find this problem anywhere.
How do I get parameters?
I think it's better to write Ruby and Rails versions.
The method for doing the desired thing is default_url_options
.
The phenomenon Haruka mentioned was that very old blog entries were caught in the search.
In Rails 4.2.0, I tried a simple program and found that default_url_options
was not a good idea.
It didn't seem to reproduce.
© 2024 OneMinuteCode. All rights reserved.