Ruby on rails 未加载轨道中的Gem
我想用宝石来象征(http://rubygems.org/gems/symbolize)我的Rails项目。我补充说Ruby on rails 未加载轨道中的Gem,ruby-on-rails,gem,Ruby On Rails,Gem,我想用宝石来象征(http://rubygems.org/gems/symbolize)我的Rails项目。我补充说 gem 'symbolize', '4.2.0' 到我的Gemfile并运行捆绑安装。如果我运行gem list--local我会看到已安装的gem 然而,当我实际尝试使用gem添加到ActiveRecord的方法时,我在运行时遇到了一个错误。即,我有: class WrittenEntry < ActiveRecord::Base symbolize :entry_
gem 'symbolize', '4.2.0'
到我的Gemfile并运行捆绑安装
。如果我运行gem list--local
我会看到已安装的gem
然而,当我实际尝试使用gem添加到ActiveRecord的方法时,我在运行时遇到了一个错误。即,我有:
class WrittenEntry < ActiveRecord::Base
symbolize :entry_type, :in => [:blog, :vorfreude, :twitter], :i18n => false
end
class writenentry[:blog,:vorfloude,:twitter],:i18n=>false
结束
它抛出:
/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `symbolize' for #<Class:0x007ff7ee8ad570> (NoMethodError)
from /Users/haldimann/Projects/nikhaldimann.com/app/models/written_entry.rb:4:in `<class:WrittenEntry>'
from /Users/haldimann/Projects/nikhaldimann.com/app/models/written_entry.rb:1:in `<top (required)>'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:359:in `require_or_load'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:313:in `depend_on'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:225:in `require_dependency'
from /Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
...
/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_-record/dynamic_-matchers.rb:50:in'method_-missing':未定义的#(nomethododerror)方法“symbol”
from/Users/haldimann/Projects/nikhaldiman.com/app/models/writed_entry.rb:4:in`'
from/Users/haldimann/Projects/nikhaldiman.com/app/models/writed_entry.rb:1:in`'
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'require'
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'block in require'
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:236:in'load\u dependenciency'
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'require'
来自/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:359:in“require\u或\u load”
来自/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:313:in'dependent\u'
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:225:in“require\u dependencity”
from/Users/haldimann/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/engine.rb:439:in`block(2层)in eager_load!'
...
看来,象征宝石不知何故从未实际加载。我可能遗漏了一些明显的问题,有什么想法吗?在github为同一个问题添加了问题:根据github的问题,这个问题似乎在最新版本的Symbol中得到了修复。你能更新到4.3.0+版本,看看是否能解决这个问题吗?