2012-03-19 202 views

回答

5

在您的環境文件,添加一個變量

應用程序/配置/環境/ development.rb

YourApp::Application.configure do 
    # other stuff... 
    config.admin_email = "[email protected]" 
end 

應用程序/配置/環境/生產。 rb

YourApp::Application.configure do 
    # other stuff... 
    config.admin_email = "[email protected]" 
end 

根據環境的不同,YourApp::Application.config.admin_email將包含兩種[email protected][email protected]

或者,如果電子郵件只能由環境名稱有所不同,我建議做這樣的事情...

admin_email = "admin_#{Rails.env}@gmail.com" 
相關問題