diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-04-05 21:54:39 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-04-05 21:55:24 +0100 |
commit | 1f7b4447a9030ccec542ecaa1e5e11e0d4622a84 (patch) | |
tree | 8286cf66e11fee73ad22352e803d586e3ab44df6 /activerecord/lib/active_record/associations/association_collection.rb | |
parent | 72f89b5d971b48a133c4c0af56fbeda35d738dae (diff) | |
download | rails-1f7b4447a9030ccec542ecaa1e5e11e0d4622a84.tar.gz rails-1f7b4447a9030ccec542ecaa1e5e11e0d4622a84.tar.bz2 rails-1f7b4447a9030ccec542ecaa1e5e11e0d4622a84.zip |
Memoize association.named_scope calls
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 6eda70d0ce..5ecdf1ac8d 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -405,6 +405,9 @@ module ActiveRecord else super end + elsif @reflection.klass.scopes[method] + @_scopes ||= {} + @_scopes[method] ||= with_scope(construct_scope) { @reflection.klass.send(method, *args) } else with_scope(construct_scope) do if block_given? |