I have a view that uses link_to to pass parameters to a controller. The url is a variable. Something is not working. I’d appreciate any clues. Thanks!
<% url1 = dialogs_path(@dialogId) %>
<%= url1 %>
<%= link_to "Go!", url1(:uid1 => @uid1, :uid2 => @uid2), :id => "my_link" %>
url1 displays correctly. However, executing link_to crashes.
You should use
dialog_path(@dialogId)instead.You’re trying to view a particular object, it’s singular and what rails expects.
Take a look here :
http://guides.rubyonrails.org/routing.html#paths-and-urls
The way you use url confuses me, try something like this :