Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord is not configured correctly when other gem use it #27777

Closed
elct9620 opened this issue Jan 23, 2017 · 3 comments
Closed

ActiveRecord is not configured correctly when other gem use it #27777

elct9620 opened this issue Jan 23, 2017 · 3 comments

Comments

@elct9620
Copy link

Steps to reproduce

Install any gem use ActiveRecord will cause this problem. ex. Rails Admin

Expected behavior

The ActiveSupport.run_load_hooks(:active_record, Base) should run after application's initialize loaded.

I found this problem because the default belongs_to_required_by_default becomes nil

Actual behavior

If any gem use ActiveRecord, the Rails will loaded like below:

  • config/application.rb
  • config/environments/*.rb
  • Gems
  • config/initializers/**/*.rb
  • ...

So, the actual on_load(:active_record) will happens when gem loaded and try to autoload ActiveRecord and not the application initialize.

Every things happen before we configured it.

System configuration

Rails version: 5.0.1

Ruby version: 2.3.1

@y-yagi
Copy link
Member

y-yagi commented Jan 27, 2017

If my understanding is right, that is a matter of gem.
I guess that ActiveRecord::Base has not re-opening in right way. Ref: #23589 (comment)

@elct9620
Copy link
Author

Yeah, I think this is same problem.

@maclover7
Copy link
Contributor

Agree with @y-yagi, this seems like an issue with the gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants