2013-07-24 71 views
1

因此,運行deprecated_mass_assignment_security.rb:14:`attr_accessible」 [投票寶石] [軌道4,5]

[leap_staging]$rails g reputation_system 

當包括寶石後的ActiveRecord,信譽體系「,要求: '在reputation_system'我的Gemfile我得到下面的錯誤:

/usr/local/rvm/gems/ruby-2.0.0-p195/gems/activemodel-4.0.0/lib/active_model/deprecated_mass_assignment_security.rb:14:in `attr_accessible': `attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one. (RuntimeError) 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-reputation-system-2.0.2/lib/reputation_system/models/evaluation.rb:25:in `<class:Evaluation>' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-reputation-system-2.0.2/lib/reputation_system/models/evaluation.rb:18:in `<module:ReputationSystem>' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-reputation-system-2.0.2/lib/reputation_system/models/evaluation.rb:17:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-reputation-system-2.0.2/lib/reputation_system.rb:25:in `<top (required)>' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' 
    from /Users/apane/Downloads/leap_staging/leap_staging/config/application.rb:7:in `<top (required)>' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands.rb:44:in `require' 
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands.rb:44:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

很明顯,我認爲這必須與軌道4和新的強PARAMS。不過,我想得到這個工作。那麼,如果我甚至無法生成這些文件,我怎麼才能使它工作或將其轉換爲strong_params?

這裏如果需要查看完整的應用程序,方便故障排除:www.github.com/apane/leap(創業板不含稅)

回答

1

您是否嘗試過加入protected_attributes寶石到你的Gemfile類似消息說?

+0

如果我不需要,我寧可不走那條路。除非沒有明確的替代方案:) – Apane101

+1

我嚴重懷疑有 - 參數解析在Rails 4中發生了變化,您可以更新代碼,使用bridge gem或不升級:-P –

+1

問題是,當我添加protected_attributes gem我的所有控制器都搞砸了。我想我不得不求助於rails 3語法?例如沒有更多的strong_params。 – Apane101

0

activerecord-reputation-system gem現在支持Rails 4(從3.0版本開始)。