Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ruby on rails - Undefined method `mass_assignment_sanitizer=' for ActiveRecord::Base:Class (NoMethodError)

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 command to run the rspec tests for my Rails project:

bundle exec rspec spec/

But it doesn't work. Instead I get this error:

/Users/mh/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/
activerecord-3.1.3/lib/active_record/base.rb:1088:in `method_missing':
undefined method `mass_assignment_sanitizer=' for
ActiveRecord::Base:Class (NoMethodError)

I've tried reinstalling rspec and changing my Gemfile, but nothing appeases the undefined method error!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Did you downgrade from Rails 3.2 RC1? Comment out the following two lines from your development.rb:

config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...