rails tutorial第10章sendgrid

时间:2015-06-04 15:14:22

标签: ruby-on-rails heroku railstutorial.org sendgrid ruby-on-rails-4.2

我是新手,并通过Michael Hartl Ruby on Rails Tutorial自我教学。

我已经完成了第10章并将所有内容都放在了开发中但是在添加了Sendgrid之后我推送到了heroko它被拒绝了以下内容:

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

我在Rails 4.2.0上。我不知道出了什么问题。这是我的生产配置:

  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
  }

我的宝石文件:

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

请大量发送智慧。

1 个答案:

答案 0 :(得分:0)

您只需要在生产gemfile中添加sendgrid-ruby gem并推送heroku。