Rails: link_to with block and GET params?
Posted
by bobthabuilda
on Stack Overflow
See other posts from Stack Overflow
or by bobthabuilda
Published on 2010-04-26T05:32:44Z
Indexed on
2010/04/26
5:43 UTC
Read the original article
Hit count: 347
How can I achieve query string and URL parameters in a link_to
block declaration? Right now, I have this, which works:
<%= link_to 'Edit', :edit, :type => 'book', :id => book %>
The above works, and outputs:
http://localhost:3000/books/edit/1?type=book
What I want to do is something like this:
<% link_to :edit, :type => 'book', :id => book do %>
...
<% end %>
But the above format outputs:
http://localhost:3000/books/edit/
Which isn't what I'm looking for... I want it to output a URL like the previous example.
How can I achieve this?
© Stack Overflow or respective owner