Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何通过Heroku和send Grid发送电子邮件激活链接?_Ruby On Rails_Ruby_Git_Heroku_Sendgrid - Fatal编程技术网

Ruby on rails 如何通过Heroku和send Grid发送电子邮件激活链接?

Ruby on rails 如何通过Heroku和send Grid发送电子邮件激活链接?,ruby-on-rails,ruby,git,heroku,sendgrid,Ruby On Rails,Ruby,Git,Heroku,Sendgrid,尝试发送电子邮件激活链接时heroku日志中出现错误: 2018-01-17T07:37:09.783615+00:00应用程序[网站1]: [f3c128f0-83ad-4879-ae6c-a54b28030290][1m[35m 0.7ms[0m [1m[35mBEGIN[0m 2018-01-17T07:37:09.891482+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290]已完成500个内部服务器 188ms ActiveR

尝试发送电子邮件激活链接时heroku日志中出现错误:

2018-01-17T07:37:09.783615+00:00应用程序[网站1]: [f3c128f0-83ad-4879-ae6c-a54b28030290][1m[35m 0.7ms[0m [1m[35mBEGIN[0m 2018-01-17T07:37:09.891482+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290]已完成500个内部服务器 188ms ActiveRecord中的错误:10.7ms 2018-01-17T07:37:09.892707+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290] 2018-01-17T07:37:09.871499+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290][1m[35m 1.1ms[0m [1m[31m后滚[0m 2018-01-17T07:37:09.892886+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290]命名法错误未定义方法 激活\u摘要=用于 2018-01-17T07:37:09.892887+00:00应用程序[web.1]:你的意思是?激活令牌=: 2018-01-17T07:37:09.892920+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290] 2018-01-17T07:37:09.892966+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290]应用程序/模型/用户。rb:71:in 创建\u激活\u摘要 2018-01-17T07:37:09.892967+00:00应用程序[web.1]:[f3c128f0-83ad-4879-ae6c-a54b28030290] app/controllers/users\u controller.rb:23:in'create' 2018-01-17T07:37:09.892966+00:00 heroku[路由器]:at=info method=POST path=/users host=letsgo228.herokuapp.com 请求id=f3c128f0-83ad-4879-ae6c-a54b28030290 fwd=61.6.75.149 dyno=web.1连接=1ms服务=194ms状态=500字节=1891 协议=https 2018-01-17T07:37:10.572375+00:00 heroku[路由器]:at=info method=GET path=/favicon.ico host=letsgo228.herokuapp.com 请求id=6b2a9847-7844-4ae9-a7df-e1405b86b08f fwd=61.6.75.149 dyno=web.1连接=0ms服务=1ms状态=304字节=112协议=https

用户模型

用户控制器


您的用户模型上没有名为activation_digest的列。rails g迁移将_activation_digest添加到_UsersActivation_digest:string:index

您是否有任何公共存储库可以查看您的模型代码或发布您的完整模型我有此def更改添加列:users,:activation_digest,:string添加列:users,:activated,:boolean,默认值:false add_column:users,:activated_at,:datetime end end end您是否运行了heroku运行rake db:migrate?
 # Creates and assigns the activation token and digest.
  def create_activation_digest
    self.activation_token  = User.new_token
    self.activation_digest = User.digest(activation_token)
  end
end
def new
    @user = User.new
  end

  def create
    @user = User.new(user_params)
    if @user.save
      @user.send_activation_email
      flash[:info] = "Пожалуйста проверьте свою почту,в течении 1 минуты придет письмо для активации аккаунта"
      redirect_to root_url
    else
      render 'new'
    end
  end