superuseroi
superuseroi

Reputation: 1348

`method_missing': undefined method `action_mailer' for #<Rails::Application::Configuration:0x00>

I am building a rails app and was using rails 4.0.1. I had an error and noticed that it was mentioned as a bug on rails 3 months ago so I decided to: bundle update and got rails 4.0.3

after doing so neither the tests nor the server would start and they throw an error:

gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for # (NoMethodError)

For the moment I commented out the action_mailer lines in the config/environments/* but it would be good to find a real solution. Searching on Google didn't yield anything regarding this specific error.

Please let me know if I can provide any more detail. Thank you very much.

UPDATE: here is my Gemfile

source 'https://rubygems.org'
ruby '2.0.0'

gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.1.2' 

group :development do
  gem 'sqlite3'
  gem 'thin'
  # gem "better_errors"
  gem "binding_of_caller"
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'pry'
  gem 'pry-nav'
end

group :test do
  gem "faker"
  gem "capybara"
  gem "database_cleaner"
  gem "launchy"
  gem 'shoulda-matchers'
  gem "selenium-webdriver"
  gem "fivemat"
  gem 'fabrication'
end

Upvotes: 6

Views: 5922

Answers (2)

deepinder
deepinder

Reputation: 131

in my case I had installed the gems and since the devkit was not installed properly the gems did not compile.

After setting up the devkit I had to uninstall all of the rails gems (actionmailer, activerecord, actioncable......) and then install rails again.

Then it worked.

Upvotes: 0

superuseroi
superuseroi

Reputation: 1348

Solution found, in case anyone lands here:

The main issue was that in my Gemfile as you can see no specific gem version was set (apart from bcrypt) Somehow this makes bundle installs outdated versions under circumstances that are not yet clear to me.

Steps to fix:

  1. completely remove the gemset (if you are using one) or uninstall all gems
  2. remove the Gemfile.lock
  3. specifiy what version of rails you need e.g. 'rails', '~> 4.0.3'
  4. bundle install

you are set :)

Upvotes: 5

Related Questions