Search code examples
ruby-on-railsruby-on-rails-4actionmailer

Generate a full URL in a Mailer view - Rails


in mailer view:

      <%= url_for(controller:'resas', action: 'show', only_path: false) %>

rake routes:

                      resa GET    /resas/:id(.:format)             resas#show

Here is the exception when trying to generate the e-mail:

No route matches {:action=>"show", :controller=>"resas"}

My host is parametered (as localhost).


Solution

  • I think you need to pass in an id for the show route. Try

    <%= url_for(controller:'resas', action: 'show', id: @resa.id, only_path: false) %>
    

    (Not sure how your resource is named)