Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:10:23+00:00 2026-06-01T12:10:23+00:00

i was wondering how do you make a helper file’s functions available to an

  • 0

i was wondering how do you make a helper file’s functions available to an action mailer? i have an action mailer called UserMailer and a helper called sessions_helper.rb. how do i make the methods available to UserMailer? ive tried ‘include’ but it gives the following error

the method im trying to get is “current_user” and i receive the error

undefined local variable or method `cookies' 

im using rails 3.2.1

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:10:25+00:00Added an answer on June 1, 2026 at 12:10 pm

    You can helpers in your mailers like this,

    class Notifier < ActionMailer::Base
    
      add_template_helper(ApplicationHelper)
    
      #...
    
    end
    

    As far as current_user go, I don’t think mailers have any concept of cookies as ActionController does. As a better design choice I’d keep my mailer independent of the current_user. Mailers are not concerned with who the current_user is ( similar to models ).
    For that matters, mailers are not even concerned with who the user is, they are concerned with “email, subject, and body”.

    So when calling mailer methods, you can pass them the user object ( it can be of the current_user or any body else ) so that they can get the email , generate the subject and the body.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if it's possible to make a method which behaves differently when called
I was wondering how I can make a script load powerpoint file, advance slides
I have a browser helper object on IE that have some clipboard history functions.
I was wondering how to make a batch file that runs a certain command/commands
I was wondering how to make a PDF file link downloadable instead of opening
I was wondering How To make a Form and Div have a max width
I'm wondering if I can define some functions in a header file and then
I'm wondering can Velocity make what I want :) For example I have <html>
I have the following code and am wondering how to make the last line
I'm wondering how to make a release build that includes all necessary DLL files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.