我是新來的action_mailer,我不知道什麼可能會出錯。我花了最後的12個小時在這個圈子裏。這可能是一個寶石依賴,這可能是我做錯了。請幫忙!行動梅勒 - Heroku推
郵件工作在我的本地環境,但我不能推到heroku。我不斷收到此錯誤:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NoMethodError: undefined method `action_mailer' for #<Rails::Application:
:Configuration:0x00000002fad208>
編輯新的錯誤之後增加鋼軌版本,以創業板FILE
Running: rake assets:precompile
I, [2014-04-01T14:00:22.863048 #796] INFO -- : Writing /tmp/build_a1da56
f1-c7f3-455c-9bea-c9bf4306ef11/public/assets/blank_tan_vig-03e2648e62e03d21bb6cb
8e57937edf8.jpg
I, [2014-04-01T14:00:22.865246 #796] INFO -- : Writing /tmp/build_a1da56
f1-c7f3-455c-9bea-c9bf4306ef11/public/assets/rails-5c3c576fb6f357c0c4d2a32214da4
4b6.png
I, [2014-04-01T14:00:27.585107 #796] INFO -- : Writing /tmp/build_a1da56
f1-c7f3-455c-9bea-c9bf4306ef11/public/assets/application-bc6a900b1f1dc90eba371ab
1e65adb36.js
rake aborted!
NoMethodError: undefined method `environment' for nil:NilClass
我試圖用山魈我的SMTP服務器。我已經安裝並配置好了heroku插件(據我所知)。我也跟着這樣的:https://devcenter.heroku.com/articles/mandrill
user_mailer文件:
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def send_welcome_email(user)
@user = user
mail(to: @user.email, subject: "Welcome to Myflix!")
end
end
生產信封
Myflix::Application.configure do
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.mandrillapp.com',
:port => 587,
:user_name => ENV['MANDRILL_USERNAME'],
:password => ENV['MANDRILL_APIKEY'], # SMTP password is any valid API key
:domain => 'heroku.com', # your domain to identify your server when connecting
:authentication => 'plain' # Mandrill supports 'plain' or 'login'
}
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end
的Gemfile:
源 'https://rubygems.org' 紅寶石 '1.9.3'
gem 'bootstrap-sass'
gem 'coffee-rails'
gem 'rails', '4.0.0'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bootstrap_form'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'fabrication'
gem 'faker'
group :development do
gem 'sqlite3'
gem 'pry'
gem 'pry-nav'
gem 'thin'
gem 'better_errors'
gem 'binding_of_caller'
gem 'letter_opener'
end
group :development, :test do
gem 'rspec-rails'
end
group :test do
gem 'shoulda-matchers'
gem 'capybara'
gem 'launchy'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
當我這樣做,我得到一個新的錯誤:沒有方法的環境。我用這個新錯誤更新了這個問題 –