在我的Heroku日志中:
Processing by UsersController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"YsNr73owFsrgM4HX5QDq304ot4gBhGBx1SlOkq+hAxg=", "user"=>{"housing_type"=>"Sublets / Shares", "area_id"=>"1", "subarea_id"=>"", "rent_min"=>"", "rent_max"=>"", "bedroom_min"=>"0", "cat"=>"0", "dog"=>"0", "pic"=>"0", "email"=>"lol.i.laugh@gmail.com"}, "commit"=>"Start your Free Trial: 10 leads"}
app/controllers/users_controller.rb:16:in `create'
Completed 500 Internal Server Error in 6ms
NameError (undefined local variable or method `confirmed_at' for #<User:0x000000048a57b0>):
app/models/user.rb:81:in `password_required?'
所以它在#create的第16行失败,这是@ user.save部分:
@user = User.new(params[:user])
if @user.save
在user.rb文件中为Devise声明了password_required方法:
def password_required?
super if confirmed?
end
我已经运行了rake db:migrate并检查迁移状态以确保它已在Heroku上完成。我也跑了
heroku run rails console
irb(main):012:0> User
=> User(id: integer, email: string, trial_count_left: integer, created_at: datetime, updated_at: datetime, rent_min: integer, rent_max: integer, bedroom_min: integer, cat: boolean, dog: boolean, pic: boolean, housing_type: string, subarea_id: integer, area_id: integer, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, confirmation_token: string, confirmed_at: datetime, confirmation_sent_at: datetime, unconfirmed_email: string)
已确认__
最后,我也经历了
heroku run rails console
irb(main):012:0> User.new( < manual params here >).save
通过翻译,一切正常。
可能出现什么问题?我不想重置整个数据库,因为它是一个生产数据库。
由于
答案 0 :(得分:2)
由于某种原因,“heroku重启”成功了。从技术上讲,我不确定背景中发生了什么,但我很高兴它现在正在工作。我将查看Heroku文档,看看我是否可以找出其潜在的技术原因。