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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:07:24+00:00 2026-06-18T17:07:24+00:00

It seems that when I run my application in production mode I am getting

  • 0

It seems that when I run my application in production mode I am getting the following inside my console:

    /home/Desktop/Portal/app/mailers/holiday_mailer.rb:2:in 
`<class:HolidayMailer>': uninitialized constant HolidayMailer::DEFAULT_FROM (NameError)

I have looked at the following SO question Rails 3 Action Mailer uninitialized constant. It appears that I have not made that mistake as my set up is as followed:

environment.rb

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

# Initialize the rails application
Portal::Application.initialize!
ActionMailer::Base.delivery_method = :smtp
DEFAULT_FROM = "portal@gmail.com"

holiday mailer

class HolidayMailer < ActionMailer::Base
  default :from => DEFAULT_FROM

  def holiday_confirmation(holiday)
    @holiday = holiday
    mail(:to => holiday.user.email, :subject => "Your Absence Request")
  end
end

Holiday Controller

 def update()
    admin = User.find(current_user.role? :administrator)
    holiday = Holiday.find(params[:id])
    user = User.find(id = holiday.user_id)

    if holiday.update_attributes(params[:holiday])
      if holiday.state == "approved"
        user.absentdays = user.absentdays - (holiday.days_used).to_i
        user.save
      end
      redirect_to absence_path, :notice => "request updated!"
      #email the user to tell them the state of their holiday
      HolidayMailer.holiday_confirmation(holiday).deliver
    else
      render 'edit'
    end
  end

It seems though this is wrong

  • 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-18T17:07:25+00:00Added an answer on June 18, 2026 at 5:07 pm

    I don’t know why it is throwing an error in the production, but I can tell you how to fix this problem.

    I replicated this scenario in my rails 3.2.11 app and I got the same error in production. There are two possible fixes.

    1. Move the variable DEFAULT_FROM into environments/production.rb
    2. Make an initializer file for mail settings (config/initializers/mail_settings.rb) and put this variable DEFAULT_FROM in that file.

      The second approach is neat, because its a configuration for mailer and the variable will be available in both development and production environments. Both these approaches would require you to restart your dev/deployment server.

      Hope this helps.

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

Sidebar

Related Questions

It seems that I have more trouble getting standard Unix things to run on
i have set up an SQLite database. it seems that when i run a
I'm using a backgroundworker to run a separate thread, however it seems that my
I'm really suprised I haven't run into this problem before, but it seems that
In jquery when I run: $('li').each(some-function(i){}); The IDE seems to know that some-function is
I've recently run into an issue that no amount of online searching seems to
We are writing unit tests for our ASP.NET application that run against a test
We have an application that is written in .NET 3.5. This app works on
We have an application in Grails 2.0 that we have working when we run
Seems that This will be an easy question for you but this problem is

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.