开发者

Paperclip gem not recognized

开发者 https://www.devze.com 2023-03-10 10:44 出处:网络
I updated to Rails 3.0.8.rc2 recently, and then updated the paperclip gem to 2.3.11 (this fails on 2.3.10 as well). On startup, the paperclip gem seems to be not registering:

I updated to Rails 3.0.8.rc2 recently, and then updated the paperclip gem to 2.3.11 (this fails on 2.3.10 as well). On startup, the paperclip gem seems to be not registering:

/Users/jade/code/plantworking/app/models/comment.rb:17: undefined method `has_attached_file' for Comment:Class (NoMethodError)
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:454:in `load'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:454:in `load_file'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:453:in `load_file'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:340:in `require_or_load'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/rails/mongoid.rb:55:in `load_model'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/rails/mongoid.rb:18:in `load_models'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/rails/mongoid.rb:17:in `each'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/rails/mongoid.rb:17:in `load_models'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/paths.rb:102:in `each'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/paths.rb:102:in `each'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/rails/mongoid.rb:16:in `load_models'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/mongoid-2.0.2/lib/mongoid/railtie.rb:86:in `_callback_before_5'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/callbacks.rb:420:in `_run_prepare_callbacks'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/callbacks.rb:40:in `initialize'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:33:in `new'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:33:in `build'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:79:in `build'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application.rb:209:in `inject'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:79:in `each'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:79:in `inject'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/actionpack-3.0.8.rc2/lib/action_dispatch/middleware/stack.rb:79:in `build'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application.rb:162:in `build_middleware_stack'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application/finisher.rb:35
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/initializable.rb:25:in `run'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/initializable.rb:49:in `each'
from /Users/jade/.rv开发者_如何学Cm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application.rb:134:in `initialize!'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application.rb:77:in `send'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/railties-3.0.8.rc2/lib/rails/application.rb:77:in `method_missing'
from /Users/jade/code/plantworking/config/environment.rb:11
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:239:in `require'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/activesupport-3.0.8.rc2/lib/active_support/dependencies.rb:239:in `require'
from /Users/jade/code/plantworking/config.ru:3
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /Users/jade/.rvm/gems/ree-1.8.7-2010.02@plantworking/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /Users/jade/code/plantworking/config.ru:1:in `new'
from /Users/jade/code/plantworking/config.ru:1

I am using Mongoid 2.0.2.

Anyone get paperclip working with Rails 3.0.8+ ?


PaperClip by default only works on ActiveRecord. You might want to try the mongoid version of PaperClip or switch over to Carrierwave.

0

精彩评论

暂无评论...
验证码 换一张
取 消