简体   繁体   中英

Rake db:migrate error - paperclip

I have installed Paperclip but I have error when I try to run

rake db:migrate

after

rails generate paperclip asset photo

I get

cannot load such file -- paperclip/tasks/attachments

What is wrong? This folder exists with that file.

尝试使用:

bundle exec rake db:migrate

When I tried downloading it as a plugin (rails plugin install ... ), I saw the same problem. I deleted the plugins from vendor/plugins directory and then added the paperclip gem to gemfile ( gem "paperclip", "~> 3.0" ) and everything now works. You may want to give it a try.

To make sure paperclip is loaded and the version which supports attachments, do

bundle show paperclip

Open the gem in text editor and check if paperclip/tasks/attachments.rb is present. If no, then the version of the gem needs to be upgraded or uninstall all paperclip gem versions and do a fresh install. paperclip-3.5.0 works.

If the version is correct and if it still throws error, include

require 'paperclip'

in your boot.rb.

This forces rails to include the gem at boot time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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