actionmailer - Rails - URL helpers not working in mailers -


i tried:

class mymailer   def routes     rails.application.routes.url_helpers   end    def my_mail     @my_route = routes.my_helper     ... code omitted    end 

also inside mailer:

include rails.application.routes.url_helpers  def my_mail   @my_route = my_helper 

also, simple way, in mailer template:

= link_to 'asd', my_helper 

but when try start console get:

undefined method `my_helper' #<module:0x007f9252e39b80> (nomethoderror) 

update

i using _url form of helper, i.e. my_helper_url

for rails 5, included url helpers mailer file:

# mailers/invoice_mailer.rb include rails.application.routes.url_helpers  class invoicemailer < applicationmailer     def send_mail(invoice)         @invoice = invoice         mail(to: @invoice.client.email, subject: "invoice test")     end end 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -