How to include full-path in Rails 3 link_to statement?

后端 未结 6 554
说谎
说谎 2021-01-17 10:17

I am trying to put a Rails link_to statement inside a Mailer email that includes the full-path (ie - http://localhost/contacts/id/confirm). The link_to statement that I am

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 10:50

    Based on the current guides http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views , I think the best way is to use the url_for and configuring a host in the enviroment config file. Or better yet to use a name route.

    Example with named route

    link_to @user.fullname, user_url(@user)
    

提交回复
热议问题