简体   繁体   English

ruby on rails回滚数据库创建问题

[英]ruby on rails rollback database created problems

I completely rolled back my migration from the beginning so I can add a few columns, now when I'm trying to create new user I get a 我从一开始就完全回滚了迁移,因此我可以添加几列,现在当我尝试创建新用户时,我得到了一个

NoMethodError in Devise::SessionsController#create

undefined method `image_changed?' for #<User:0x007fa99ea152f8>

I'm using devise and I have carrierwave. 我正在使用设备,并且有载波。 My application worked, and I had images before, but when I rolled back and deleted the images from the upload folder, I get this undefined method. 我的应用程序正常运行,并且以前有图像,但是当我回滚并从上载文件夹中删除图像时,得到了这个未定义的方法。

Does anyone know where this is coming from? 有人知道这是哪里来的吗? I'm completely clueless, 我完全不知道

Thanks 谢谢

I believe that inside your user model you may have carrierwave still mounted to your model. 我相信,在user模型内部,您可能仍在安装载波。

class User < ActiveRecord::Base
  mount_uploader :image, ImageUploader  
  #mounts the uploader to the given column in this case which it is :image
end

The error undefined method image_changed?' 错误undefined method image_changed? for #` indicates that you must be missing some sort of column fro your model. #表示您必须在模型中缺少某些列。

1) rails g migration AddImageToUsers image:string 1) rails g migration AddImageToUsers image:string

2) Run rake db:migrate 2)运行rake db:migrate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM