pitachip
pitachip

Reputation: 965

Trouble with accessing helpers from mailers in Rails 3

I am using Rails 3.0.3. I tried using all of the methods in the multiple questions on this site that were this question, but I still can't seem to access my helper methods from my mailer. I tried using the 'helper :application' as follows:

class MyMailer < ActionMailer::Base
  default :from => "[email protected]>"

  helper :application
end

I also tried 'helper ApplicationHelper' as well as 'add_template_helper(ApplicationHelper)'. There is nothing wrong with the helper methods which work just fine for views. Is there something I am missing? Maybe a line in the mailer setup file or something? Thanks so much in advance.

Upvotes: 1

Views: 432

Answers (2)

scrozier
scrozier

Reputation: 334

Instead of helper :application, use extend ApplicationHelper. include ApplicationHelper does not work, at least in Rails 3.2.

Upvotes: 1

Sully
Sully

Reputation: 14943

class MyMailer < ActionMailer::Base
    include ApplicationHelper

.
.

end

Upvotes: 0

Related Questions