I'm trying to do something like so:
link_to_unless_current "Inbox", messages_path(:inbox => true)
But, it seems that link_to_unless_current only works if I go to " http://localhost/messages " and not " http://localhost/messages?inbox=true " (ie it doesn't give a link for the latter which is correct, but it does for the former which is incorrect).
Any ideas on how to make:
link_to_unless_current "Inbox", messages_path(:inbox => true)
work correctly?
怎么样:
link_to_unless_current "Inbox", messages_path(:inbox => "true")
I'm not 100% sure (and I definitely would like to hear why) but I think if you try to pass in a boolean parameter that is true it gets ignored you need either a false boolean or any other things.
link_to_unless_current "Inbox", messages_path(:inbox => 1)
Or you could use routes
match "/messages/:folder" => "messages#index", :as => :messages_folder
and then
link_to_unless_current "Inbox", messages_folder_url(:folder => "Inbox")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.