【问题标题】:rails tutorial chapter 10 sendgridrails 教程第 10 章 sendgrid
【发布时间】:2015-06-04 15:14:22
【问题描述】:

我是新手,通过 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
  }

还有我的 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

请批量发送智慧。

【问题讨论】:

  • 你好像有config.action.mailer。也许不是mailer,还有别的。在项目范围内搜索 config.action. 可能会产生一些结果。
  • 同意上述评论。从您的应用程序文件夹中执行grep -r "config.action." * 以查找流氓配置。
  • 如果您感到绝望,我还建议您联系 Michael Hartl。我以前看过他的教程,当我遇到问题时他会及时回复。您可以使用 railstutorial 网站上的联系信息。
  • 你重启你的rails服务器了吗???
  • 您是否在 heroku 上设置了 SendGrid 应用程序?

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2018-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多