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

前端 未结 3 1693
鱼传尺愫
鱼传尺愫 2020-11-30 05:39

Before writing this question I looked at these answers, but was unable to find a solution.:

Error when execute rails generate scaffold User name:string email:string

相关标签:
3条回答
  • 2020-11-30 05:52

    I had the same issue when upgrading an app from Rails 5.0.1 to Rails 5.1.0.beta1.

    When starting the server (rails s), I got the following error message:

    /home/user01/.rvm/gems/ruby-2.4.0@global/gems/activerecord-5.1.0.beta1/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
    

    Same ills, same cures.

    Commenting out the following line, in config/application.rb, solved the issue...

    config.active_record.raise_in_transactional_callbacks = true
    

    After some investigation, I found that this line was default in Rails 4.2.1, vanished in Rails 5.0.0, and now raises an error in Rails 5.1.0.beta1...

    0 讨论(0)
  • 2020-11-30 06:00

    Your config/application.rb has the following line:

    config.active_record.raise_in_transactional_callbacks = true

    This is not a valid configuration value in your version of Rails. You will need to delete it or comment it out to continue.


    Note: this error and the one that preceded it are indicative of an incomplete Rails version change. If you are in the early stages of a tutorial, you might seriously consider restarting your application using your preferred version of Rails from the very start. This will help you avoid this type of error until you are more familiar with the technology.

    0 讨论(0)
  • 2020-11-30 06:02

    If you don't see config.active_record.raise_in_transactional_callbacks = true in config/application.rb it might exist in your environment configs. For my app it was being set it in config/environments/development.rb and config/environments/test.rb

    0 讨论(0)
提交回复
热议问题