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

Let AR::Base properly lazy-loaded if Railtie is available #114

Merged
merged 2 commits into from
Mar 28, 2014
Merged

Let AR::Base properly lazy-loaded if Railtie is available #114

merged 2 commits into from
Mar 28, 2014

Conversation

amatsuda
Copy link
Contributor

Since the current code calls ActsAsList::Railtie.insert in the top-level, just requiring this gem (usually via Bundler) would immediately load AR::Base and trigger all of its initializers, which would slowdown the server startup, spec execution that does not depend on AR, etc.

Also, currently ActsAsList::Railtie.insert call happens three times on the gem initialization, which of course is actually needed to be done only once.

@swanandp
Copy link
Contributor

Good catch, thanks @amatsuda !

swanandp added a commit that referenced this pull request Mar 28, 2014
Let AR::Base properly lazy-loaded if Railtie is available
@swanandp swanandp merged commit 61f0918 into brendon:master Mar 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants