Reputation: 110940
This doesn't give the full URL, which breaks as it's in a mailer
<%= link_to @conversation.title, conversations_path %>
This gives me the full URL, which is good:
<%= conversations_url(:only_path => false) %>
How do I get the best of both worlds? I want to link_to but have the full path?
Thanks
Upvotes: 3
Views: 4649
Reputation: 779
Without testing this.. Have you tried this?
<% conversations_url(:only_path => false) do %>
@conversation.title
<% end &>
Upvotes: 6
Reputation: 453
Thanks Oluf, ran into your answer when I was trying to fix a similiar problem.
The link may be rewritten into:
<%= link_to( @conversation.title, conversations_url( :only_path => false)) %>
Upvotes: 4