我无法在由carrierwave上传器安装的属性上使用model.update_attribute. sql语句不接受该值并向占位符添加NULL.如果我从模型类中删除mount_uploader语句,它将正常工作.我正在从控制台进行故障排除,并试图在播种数据库时添加一些属性,这阻碍了我的努力.想法?
谢谢.
更新:
相关代码:
class Profile < ActiveRecord::Base belongs_to :user has_and_belongs_to_many :sports has_and_belongs_to_many :interests has_and_belongs_to_many :minors has_and_belongs_to_many :majors has_and_belongs_to_many :events has_and_belongs_to_many :groups attr_accessible :description,:username,:avatar,:bio,:first_name,:last_name,:major,:minor,:graduation_date,:living_situation,:phone,:major_ids,:minor_ids,:sport_ids mount_uploader :avatar,AvatarUploader end
我只是试图从db种子文件重写:avatar字符串,并从rails控制台进行测试,如下所示:
Profile.first.update_attribute(:avatar,’foo’)
当我注释掉mount_uploader行时,两者都有效.