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 8370641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:57:43+00:00 2026-06-09T13:57:43+00:00

I have the following mailing code in app/models. class Mailman < ActionMailer::Base default :from

  • 0

I have the following mailing code in app/models.

class Mailman < ActionMailer::Base

  default :from => "xyz"
  # Sends an Email reminder to all the users who missed a pickup date
  def check_out_reminder(reservation)
    recipient = reservation.user.mail
    subject   = "Checkout Reminder for '#{reservation.bookable.name}'."
    mail(:to => recipient, :subject => subject)
  end

  def check_in_reminder(reservation)
    recipient = reservation.user.mail
    subject   = "Checkin Reminder for '#{reservation.bookable.name}'."
    mail(:to => recipient, :subject => subject)
  end

end

I have test code in test/unit which goes as:

require File.expand_path('../../test_helper', __FILE__)

class MailmanTest < ActionMailer::TestCase
  fixtures :reservations

  def test_check_out_reminder
    reservation = Reservation.first 
    # Send the email, then test that it got queued
    Mailman.check_out_reminder(reservation).deliver
    assert !ActionMailer::Base.deliveries.empty?
  end

end

The test on execution however gives an error:

test_check_out_reminder(MailmanTest):
NoMethodError: undefined method `mail' for nil:NilClass
    /Users/myth/Learn/Code/redmine/plugins/redmine_asset_tracker/app/models/mailman.rb:9:in `check_out_reminder'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in `process_action'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:121:in `process'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.3/lib/abstract_controller/rendering.rb:45:in `process'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:456:in `process'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:451:in `initialize'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:438:in `new'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.3/lib/action_mailer/base.rb:438:in `method_missing'
    /Users/myth/Learn/Code/redmine/plugins/redmine_asset_tracker/test/unit/mailer_test.rb:9:in `test_check_out_reminder'
    /Users/myth/.rvm/gems/ruby-1.9.3-p0/gems/mocha-0.11.4/lib/mocha/integration/mini_test/version_230_to_262.rb:28:in `run' 

Why is the mail method not being recognized even when I am inheriting the right class?

  • 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-09T13:57:44+00:00Added an answer on June 9, 2026 at 1:57 pm

    The issue was a missing fixture.
    The line recipient = reservation.user.mail was causing the error and not the Action Mailer’s mail(:to => recipient, :subject => subject)

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

Sidebar

Related Questions

I have the following code: index.html <HTML> <HEAD> <TITLE>My App</TITLE> <LINK rel=stylesheet type=text/css href=style.css>
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following question on adobe omniture How we can register an iPhone app
I have following SQL statementL: select DATE(bla), count(*) from tableA group by DATE(bla) UNION
We have the following query to give us a left outer join: (from t0
Have following code: public interface ITest { string St1 { get; } } public
I have following batch file code: @echo off SET INSTALL_PATH=c:\program files\ :ask_again if exist
I have following structure of an HTML document: <body> <div class=main> <div class=left></div> <div
I have following code for an autocomplete box, I'm adding an image for choice
I have the following code running to create a dropdown accordion that reveals the

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.