rake db:种子已中止(未初始化的常量ActiveRecord :: Type)

时间:2017-07-01 14:50:12

标签: ruby-on-rails ruby activerecord enumerize

我有一个新项目,运行种子文件(rake db:seed)给了我这个错误:

rake aborted!
NameError: uninitialized constant ActiveRecord::Type
/Users/mekto/.gem/ruby/2.1.4/gems/enumerize-2.1.2/lib/enumerize/activerecord.rb:69:in `<module:ActiveRecordSupport>'
/Users/mekto/.gem/ruby/2.1.4/gems/enumerize-2.1.2/lib/enumerize/activerecord.rb:2:in `<module:Enumerize>'
/Users/mekto/.gem/ruby/2.1.4/gems/enumerize-2.1.2/lib/enumerize/activerecord.rb:1:in `<top (required)>'
/Users/mekto/.gem/ruby/2.1.4/gems/enumerize-2.1.2/lib/enumerize.rb:35:in `extended'
/Users/mekto/web/redhat/rhcsa/sherpa/app/models/task.rb:55:in `extend'
/Users/mekto/web/redhat/rhcsa/sherpa/app/models/task.rb:55:in `<class:Task>'
/Users/mekto/web/redhat/rhcsa/sherpa/app/models/task.rb:21:in `<top (required)>'
/Users/mekto/web/redhat/rhcsa/sherpa/db/seeds.rb:44:in `<top (required)>'
/Users/mekto/.gem/ruby/2.1.4/gems/railties-3.2.13/lib/rails/engine.rb:520:in `load_seed'
/Users/mekto/.gem/ruby/2.1.4/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:347:in `block (2 levels) in <top (required)>'
/Users/mekto/.gem/ruby/2.1.4/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:seed

从这些日志中,问题似乎出现在task.rb文件和enumerize模块中。

它抱怨的task.rb文件中的代码:

 extend Enumerize
 enumerize :track, in: {:learning => 0, :action => 1}, default: :learning

 acts_as_list scope: :step
 has_paper_trail ignore: [:updated_at, :impressions_count]
 is_impressionable :counter_cache => true

TNX, 汤姆

0 个答案:

没有答案