我在Gemfile中添加了以下宝石:
gem 'rails', '~> 4.2.7.1'
gem 'spree_core', '3.1.1'
gem 'spree_api', '3.1.1'
gem 'spree_backend', '3.1.1'
gem 'spree_auth_devise', '~> 3.1.0'
gem 'delayed_job_active_record'
我有一节课:
module Spree
class EntityAttribute < Spree::Base
validates_length_of :entity, :maximum => 100
...
...
end
end
使用此代码,当我运行bundle exec rake jobs:work
时,出现以下错误:
[工人(主持人:My.local pid:4654)]开始求职者
耙子流产了! TypeError:类EntityAttribute的超类不匹配 /Users/saurabh.mimani/work/codes/local/local_web_backend/app/models/spree/entity_attribute.rb:2:in<module:Spree>' /Users/saurabh.mimani/work/codes/local/local_web_backend/app/models/spree/entity_attribute.rb:1:in
” /Users/saurabh.mimani/work/codes/local/local_web_backend/vendor/bundle/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:inload' /Users/saurabh.mimani/work/codes/local/local_web_backend/vendor/bundle/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in
阻止加载' /Users/saurabh.mimani/work/codes/local/local_web_backend/vendor/bundle/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:inload_dependency' /Users/saurabh.mimani/work/codes/local/local_web_backend/vendor/bundle/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in
负载” /Users/saurabh.mimani/work/codes/local/local_web_backend/config/application.rb:14:inblock (2 levels) in <class:Application>' /Users/saurabh.mimani/work/codes/local/local_web_backend/config/application.rb:13:in
的glob” /Users/saurabh.mimani/work/codes/local/local_web_backend/config/application.rb:13:in `阻止'
当我用class EntityAttribute < Spree::Base
替换它时,它工作正常
class EntityAttribute < ActiveRecord::Base
喜欢这样:
module Spree
class EntityAttribute < ActiveRecord::Base
...
...
当我更改模块范围时,我也会收到错误,如下所示:
module Spree123
class EntityAttribute < Spree::Base
...
...
我也在整个代码中搜索过,没有其他名称为EntityAttribute
这个错误的原因是什么,以及如何使其发挥作用。