Rails 设计设置
Rails settings of devise
我在本地机器上安装了设计gem。一切正常。但是后来我将我的应用程序转移到 Heroku 我得到了那个错误,然后创建新用户
Email translation missing:
ru.activerecord.errors.models.user.attributes.email.taken
我建议问题出在文件 config/environment/production.rb
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
对于 heroku,您必须为邮件程序设置 sendgrid
。
使用
更改生产中邮件程序的配置
config.log_formatter = ::Logger::Formatter.new
config.action_mailer.default_url_options = { :host => 'your-domain' }
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN']
}
发生这种情况是因为您的语言设置。
请检查您的 config/locales/devise.ru.yml
ru:
activerecord:
errors:
models :
user:
attributes:
email:
taken: "Whatever you want"
如果你觉得这是因为 sendgrid,那么请像下面这样设置
config.action_mailer.asset_host = "YOUR-URL"
config.action_mailer.default_url_options = { :host => "YOUR-URL", :only_path => false }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN']
}
我在本地机器上安装了设计gem。一切正常。但是后来我将我的应用程序转移到 Heroku 我得到了那个错误,然后创建新用户
Email translation missing:
ru.activerecord.errors.models.user.attributes.email.taken
我建议问题出在文件 config/environment/production.rb
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
对于 heroku,您必须为邮件程序设置 sendgrid
。
使用
更改生产中邮件程序的配置config.log_formatter = ::Logger::Formatter.new
config.action_mailer.default_url_options = { :host => 'your-domain' }
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN']
}
发生这种情况是因为您的语言设置。 请检查您的 config/locales/devise.ru.yml
ru:
activerecord:
errors:
models :
user:
attributes:
email:
taken: "Whatever you want"
如果你觉得这是因为 sendgrid,那么请像下面这样设置
config.action_mailer.asset_host = "YOUR-URL"
config.action_mailer.default_url_options = { :host => "YOUR-URL", :only_path => false }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN']
}