我最近尝试安装rails 4.1.0.beta1
,但rails s
会导致以下错误。
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `graft' for class `ActiveRecord::Associations::JoinDependency' (NameError)
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
[RVM]/gems/ruby-2.0.0-p247/gems/polyamorous-0.6.4/lib/polyamorous/join_dependency.rb:7:in `block in included'
[RVM]/gems/ruby-2.0.0-p247/gems/polyamorous-0.6.4/lib/polyamorous/join_dependency.rb:5:in `class_eval'
[RVM]/gems/ruby-2.0.0-p247/gems/polyamorous-0.6.4/lib/polyamorous/join_dependency.rb:5:in `included'
[RVM]/gems/ruby-2.0.0-p247/gems/polyamorous-0.6.4/lib/polyamorous.rb:20:in `include'
[RVM]/gems/ruby-2.0.0-p247/gems/polyamorous-0.6.4/lib/polyamorous.rb:20:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/ransack-1.1.0/lib/ransack/adapters/active_record/3.1/context.rb:3:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/ransack-1.1.0/lib/ransack/adapters/active_record/3.2/context.rb:2:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/ransack-1.1.0/lib/ransack/adapters/active_record/context.rb:2:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/ransack-1.1.0/lib/ransack/adapters/active_record.rb:12:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/ransack-1.1.0/lib/ransack.rb:22:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/bundler/gems/active_admin-85b9f8164809/lib/active_admin.rb:2:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:232:in `load_dependency'
[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/dependencies.rb:247:in `require'
[RVM]/gems/ruby-2.0.0-p247/bundler/gems/active_admin-85b9f8164809/lib/activeadmin.rb:1:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
[RAILS_ROOT}/config/application.rb:8:in `<top (required)>'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `require'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `block in server'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `tap'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `server'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
[RVM]/gems/ruby-2.0.0-p247/gems/railties-4.1.0.beta1/lib/rails/commands.rb:17:in `<top (required)>'
这是我目前的系统。
为什么会失败?
答案 0 :(得分:19)
由于Ransack依赖的Polyamorous,它失败了。
这是activerecord-hackery/polyamorous
中的一个未解决的问题,需要关注https://github.com/activerecord-hackery/polyamorous/issues/6
<强>更新强>
要使其与4.1一起使用,请将其放在Gemfile
gem 'formtastic', github: 'justinfrench/formtastic'
gem 'ransack', github: 'activerecord-hackery/ransack', branch: 'rails-4.1'
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
gem 'activeadmin', github: 'gregbell/active_admin'