问题
We want to send an autogenerated E-Mail with an full path to the profile. How do we this
<%=link_to('Link', :controller => 'mycontroller', :action => 'show', :id => @mycontroller.id )%>
The link_to command only builds the link in the mail like this
mycontroller/show/id
we need an link like this structure
http://www.server.tld/mycontroller/show/id
Can everyone help us please?
回答1:
you can pass :only_path => false
<%= link_to('Link', :controller => 'mycontroller', :action => 'show', :id => @mycontroller.id, :only_path => false ) %>
来源:https://stackoverflow.com/questions/10437811/generate-an-real-url-with-rails-for-an-e-mail