aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #14544 from jefflai2/named_scope_sti"Rafael Mendonça França2014-05-211-2/+2
| | | | | | | | | | | | This reverts commit 9a1abedcdeecd9464668695d4f9c1d55a2fd9332, reversing changes made to c72d6c91a7c0c2dc81cc857a1d6db496e84e0065. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/comment.rb This change break integration with activerecord-deprecated_finders so I'm reverting until we find a way to make it work with this gem.
* Fixes Issue #13466.Jefferson Lai2014-04-231-2/+2
| | | | | | Changed the call to a scope block to be evaluated with instance_eval. The result is that ScopeRegistry can use the actual class instead of base_class when caching scopes so queries made by classes with a common ancestor won't leak scopes.
* Move changed_attributes into dirty.rbKeenan Brock2014-01-221-0/+5
| | | Move serialization dirty into serialization.rb
* hides the per thread registry instance, and caches singleton methodsXavier Noria2013-04-131-5/+1
| | | | | | | | | | | | Existing code was delegating to the instance with delegate macro calls, or invoking the instance method to reach the object and call its instance methods. But the point is to have a clean class-level interface where the thread local instance is hidden in the implementation. References #11c6973. References #10198.
* Changed the ScopeRegistry and the InstrumentationRegistry to use thewangjohn2013-04-091-6/+6
| | | | PerThreadRegistry module.
* Delegating the value getter and setters in the ScopeRegistry to thewangjohn2013-04-081-7/+14
| | | | current ScopeRegister object.
* Grouping thread locals in the ActiveRecord scopes so that thewangjohn2013-04-081-2/+53
| | | | | current_scope and ignore_default_scope locals are brought together under a registry object.
* Fix scope chaining + STIJon Leighton2013-04-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See #9869 and #9929. The problem arises from the following example: class Project < ActiveRecord::Base scope :completed, -> { where completed: true } end class MajorProject < Project end When calling: MajorProject.where(tasks_count: 10).completed This expands to: MajorProject.where(tasks_count: 10).scoping { MajorProject.completed } However the lambda for the `completed` scope is defined on Project. This means that when it is called, `self` is Project rather than MajorProject. So it expands to: MajorProject.where(tasks_count: 10).scoping { Project.where(completed: true) } Since the scoping was applied on MajorProject, and not Project, this fails to apply the tasks_count condition. The solution is to make scoping apply across STI classes. I am slightly concerned about the possible side-effects of this, but no tests fail and it seems ok. I guess we'll see.
* Refactor to use each_key, remove extra spacesCarlos Antonio da Silva2013-01-281-2/+0
|
* load active_support/concern in active_support/railsXavier Noria2012-08-021-1/+0
|
* extract #with_scope and #with_exclusive_scope to ↵Jon Leighton2012-04-251-121/+0
| | | | active_record_deprecated_finders
* Move DefaultScope and NamedScope under ScopingJon Leighton2011-12-151-0/+5
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+147