Undefined method `mass_assignment_sanitizer=' for ActiveRecord::Base:Class (NoMethodError)

前端 未结 2 1516
抹茶落季
抹茶落季 2020-12-15 17:43

I\'m learning Rails with the awesome Ruby on Rails Tutorial by Michael Hartl. I\'m on section 3.2.2 (Test Driven Development) in which I need to run the following c

2条回答
  •  爱一瞬间的悲伤
    2020-12-15 18:24

    While m818's answer will solve the problem, you might still get errors if you are tyring to use deprecated methods elsewhere in your code.

    I had the same problem, commenting out those lines got rid of some errors, but not all of them, anywhere I was using attr_accessible gave me the same error.

    It turned out to be the `active_record' gem that was updated to 4.0 when I didn't want it to. Since I'm using a Padrino app, I had to do this in the Gemfile:

    gem 'activerecord', '= 3.2.12', :require => "active_record"
    

    That solved all issues and I didn't have to comment out the lines in database.rb.

提交回复
热议问题