1

我最近安装了“ ar-extension ”gem。安装后,当我运行rails crails s时,我收到以下错误:

/usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:427:in `<class:SqliteRegexp>': undefined method `class_inheritable_accessor' for ActiveRecord::Extensions::SqliteRegexp:Class (NoMethodError)
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:426:in `<module:Extensions>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions/extensions.rb:112:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/init.rb:10:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/ar-extensions-0.9.2/lib/ar-extensions.rb:5:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
    from /home/infibeam/Aptana_studio_3/workspace/DigitalAssetManagement/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我已经用谷歌搜索了错误,但徒劳无功..请帮助我知道到底出了什么问题。

4

3 回答 3

5

您尝试使用的 gem 与 rails 3.2 不兼容。class_inheritable_accessor已被弃用,取而代之的是class_attribute.

你可以寻找这个 gem 的 rails 3.2 fork,做你自己的移植,或者寻找替代品。

于 2012-09-07T08:02:29.063 回答
1

实际上 ar-extensions 不适用于 rails3 for rails 3 我们有主动导入作为替代方案,它工作得非常好..;)

于 2012-09-10T06:02:27.423 回答
0

请为 rails 3 使用 activerecord-import gem

https://github.com/zdennis/activerecord-import/wiki

书籍= []
10 次做 |i|
  书“书#{i}”)
结尾
Book.import 书籍
于 2012-12-28T08:47:58.653 回答