Hello! I do an example on the Tutorial and stumble on the execution of $ bundle exec rake db:migrate , I get the following output:

 @:~/rails/demo % bundle exec rake db:migrate config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: * development - set it to false * test - set it to false (unless you use a tool that preloads your test environment) * production - set it to true rake aborted! NoMethodError: undefined method `whitelist_attributes=' for #<Class:0x0000080d034c78> Tasks: TOP => db:migrate => db:load_config (See full trace by running task with --trace) 

What are my actions to be?

Added Now, after the actions taken are described in the comments, we need an explanation of what it all means.

  • after I commented out the parameter `config.active_record.whitelist_attributes` in config / application.rb, I have the error NoMethodError: undefined method 'mass_assignment_sanitizer=' for #<Class:0x0000080cf090d8> - dile
  • commented out in configurations config.active_record.mass_assignment_sanitizer and config.active_record.auto_explain_threshold_in_seconds - dile
  • now I only get config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: - dile
  • the message disappeared after writing in production.rb config.eager_load = true , and in the rest of the config / environments / *. rb config.eager_load = false - dile

1 answer 1

You did not set config.eager_load in the environment files - config.eager_load is why it was nil . And it must be defined - to be true or false . The interesting thing is that with Rails 4.0.1 during migrations this parameter should be ignored, because it is set in the task - but the test for existence, apparently, still happens.

Perhaps you have generated the application by third rails , where this option has not yet been. How did this happen, I find it difficult to say. You may have deviated from the instructions in the book. There are a lot of small, but sharp details, because of which something can go wrong. Himself on this stumbled a couple of times. The generator in Rails 4 produces a ready-to-run application, which already has these options in its media files.

  • Yes, I saw that I was working with rails3, but I went on to do without paying attention to it; My point is that I put rubygem-rails on FreeBSD, and for rails4 I need rubygem-rails4 - dile
  • @dile the Bundler should deal with this if the gemfile clearly indicates the version of the rail. - D-side