我有一个seeds.rb文件:
activity1 = Activity.create! :name => 'Football', :icon => File.read("#{Rails.root}/public/images/activity_icons/football.png")
但是当我跑的时候
rake db:种子
,进程失败,并收到错误消息:
You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.
If this is a file upload, please check that your upload form is multipart encoded.
好吧,手动图标上传确实有用,因为我的表单
是
多部分编码,所以我猜rake正在使用它自己的运行seeds.rb的表单。
我要做什么才能使这工作?除了每次重新创建数据库时手动添加图标之外