2

我想在我的 Rails 项目中使用 symbolize gem (http://rubygems.org/gems/symbolize)。我添加了

gem 'symbolize', '4.2.0'

到我的 Gemfile 并运行bundle install. 如果我运行,gem list --local我会看到已安装的 gem。

但是,当我实际尝试使用 gem 添加到 ActiveRecord 的方法时,我在运行时遇到错误。即,我有:

class WrittenEntry < ActiveRecord::Base
  symbolize :entry_type, :in => [:blog, :vorfreude, :twitter], :i18n => false
end

哪个抛出:

/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!'
    ...

似乎符号化宝石以某种方式从未实际加载。我可能会遗漏一些明显的东西,有什么想法吗?

4

0 回答 0