diff options
author | Pavel Gorbokon <pahanix@gmail.com> | 2010-11-24 10:17:49 +0200 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-15 14:02:30 -0800 |
commit | 96bae30538951367a82235785e7dba3577b50a5a (patch) | |
tree | f32ea8949e2faf5f63ecded1b827a4a7cd1e1606 /activerecord/lib | |
parent | aa40543022303d8a1b695e73ed71406c0da15bde (diff) | |
download | rails-96bae30538951367a82235785e7dba3577b50a5a.tar.gz rails-96bae30538951367a82235785e7dba3577b50a5a.tar.bz2 rails-96bae30538951367a82235785e7dba3577b50a5a.zip |
Replace rudimentary named_scope with scope. [#6052 state:resolved]
* rename method names (actually in tests)
* rename instance variable @_named_scopes_cache to @_scopes_cache
* rename references in doc comments
* don't touch CHANGELOG :)
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 16 | ||||
-rw-r--r-- | activerecord/lib/active_record/base.rb | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index abb17a11c6..11a7a725e5 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -102,7 +102,7 @@ module ActiveRecord def reset reset_target! - reset_named_scopes_cache! + reset_scopes_cache! @loaded = false end @@ -160,7 +160,7 @@ module ActiveRecord load_target delete(@target) reset_target! - reset_named_scopes_cache! + reset_scopes_cache! end # Calculate sum using SQL, not Enumerable @@ -253,7 +253,7 @@ module ActiveRecord load_target destroy(@target).tap do reset_target! - reset_named_scopes_cache! + reset_scopes_cache! end end @@ -409,9 +409,9 @@ module ActiveRecord if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) super elsif @reflection.klass.scopes[method] - @_named_scopes_cache ||= {} - @_named_scopes_cache[method] ||= {} - @_named_scopes_cache[method][args] ||= with_scope(@scope) { @reflection.klass.send(method, *args) } + @_scopes_cache ||= {} + @_scopes_cache[method] ||= {} + @_scopes_cache[method][args] ||= with_scope(@scope) { @reflection.klass.send(method, *args) } else with_scope(@scope) do if block_given? @@ -442,8 +442,8 @@ module ActiveRecord @target = Array.new end - def reset_named_scopes_cache! - @_named_scopes_cache = {} + def reset_scopes_cache! + @_scopes_cache = {} end def find_target diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 7b9ce21ceb..d0f33c1d18 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -852,8 +852,8 @@ module ActiveRecord #:nodoc: # limit(10) # Fires "SELECT * FROM posts LIMIT 10" # } # - # It is recommended to use block form of unscoped because chaining unscoped with <tt>named_scope</tt> - # does not work. Assuming that <tt>published</tt> is a <tt>named_scope</tt> following two statements are same. + # It is recommended to use block form of unscoped because chaining unscoped with <tt>scope</tt> + # does not work. Assuming that <tt>published</tt> is a <tt>scope</tt> following two statements are same. # # Post.unscoped.published # Post.published |