-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add eager loading #980
Add eager loading #980
Conversation
I definitely think we want to have this in CHANGELOG, please. Would you also care to provide some explanation of why you think this could be better? |
|
I am sold ;) |
Sorry, what's the meaning of config.autoload_paths += %W(#{config.root}/extras)
# root/extras/foo.rb
class Foo
end
# root/app/models/blog.rb
class Blog < ActiveRecord::Base
end Things are ok in development defined?(Blog)
# => nil
defined?(Foo)
# => nil
Blog
# => Blog (call 'Blog.connection' to establish a connection)
Foo
# => Foo
defined?(Blog)
# => "constant"
defined?(Foo)
# => "constant" But on the production, the situation is a little different… defined?(Blog)
# => "constant"
defined?(Foo)
# => nil
Blog
# => Blog (call 'Blog.connection' to establish a connection)
Foo
# => Foo
defined?(Blog)
# => "constant"
defined?(Foo)
# => "constant" Even before we try to use Blog for the very first time, the class is already loaded and the constant is known. Why is that so? Because of eager loading. |
:), I will add CHANGELOG later. |
"I am sold" means "you sold me the reason to do this", which means "I agree with this change because your argument makes sense". So yes, update CHANGELOG and we're good to go. |
updated. |
@@ -14,7 +15,6 @@ | |||
* [#957](/~https://github.com/intridea/grape/pull/957): Regexp validator now supports `allow_blank`, `nil` value behavior changed - [@calfzhou](https://giihub.com/calfzhou). | |||
* [#962](/~https://github.com/intridea/grape/pull/962): The `default` attribute with `false` value is documented now - [@ajvondrak](/~https://github.com/ajvondrak). | |||
* [#974](/~https://github.com/intridea/grape/pull/974): Add error! to rescue_from blocks - [@whatasunnyday](/~https://github.com/whatasunnyday). | |||
* Your contribution here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this back please?
ok. |
Merged. |
http://blog.plataformatec.com.br/2012/08/eager-loading-for-greater-good/
Eager loading may be greater good.