0
votes

I'm newbie, and self-teaching myself via Michael Hartl's Ruby on Rails Tutorial.

I've made it as far as Chapter 10 and have everything working in development but after adding Sendgrid my push to heroko it is rejected with the following:

 NoMethodError: undefined method `action' for #<Rails::Application::Configuration:0x007fc6e0b67778>

I'm on Rails 4.2.0. I'm at a loss as to what is wrong. Here's my production configuration:

  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'salty-plateau-4554.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.sendgrid.net',
    :port           => '587',
    :authentication => :plain,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => 'heroku.com',
    :enable_starttls_auto => true
  }

And my gemfile:

source 'https://rubygems.org'

gem 'rails',                   '4.2.0'
gem 'bcrypt',                  '3.1.7'
gem 'faker',                   '1.4.2'
gem 'carrierwave',             '0.10.0'
gem 'mini_magick',             '3.8.0'
gem 'fog',                     '1.23.0'
gem 'will_paginate',           '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass',          '3.2.0.0'
gem 'sass-rails',              '5.0.1'
gem 'uglifier',                '2.5.3'
gem 'coffee-rails',            '4.1.0'
gem 'jquery-rails',            '4.0.3'
gem 'turbolinks',              '2.3.0'
gem 'jbuilder',                '2.2.3'
gem 'sdoc',                    '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'puma',           '2.11.1'
end

Please send wisdom in bulk.

1
You seem to have config.action.mailer. Maybe not mailer, something else. A project-wide search for config.action. might yield something. - D-side
Agree to the above comment. Do a grep -r "config.action." * from your app folder to find the rogue config. - Prakash Murthy
If you get desperate, I would also recommend contacting Michael Hartl himself. I've gone through his tutorial before and he was responsive when I had issues. You can use the contact info on the railstutorial website. - Agazoom
have you restart your rails server???? - Jean
Did you set up the SendGrid app on heroku? - Elvn

1 Answers

0
votes

You just need to add sendgrid-ruby gem in your production gemfile and push on heroku.