Reputation: 4632
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" (i.e. 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?
Upvotes: 0
Views: 504
Reputation: 10564
How about:
link_to_unless_current "Inbox", messages_path(:inbox => "true")
Upvotes: 2
Reputation: 2913
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")
Upvotes: 1