aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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