aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/null_relation.rb
Commit message (Collapse)AuthorAgeFilesLines
* Delegate all calculations to the scope.Jon Leighton2012-11-091-0/+4
| | | | | | | So that the scope may be a NullRelation and return a result without executing a query. Fixes #7928
* Nullify the relation at a more general level.Jon Leighton2012-11-091-1/+1
| | | | | | | | | | | | | | | This allows us to avoid hacks like the "return 0 if owner.new_record?" in #count (which this commit removes). Also, the relevant foreign key may actually be present even on a new owner record, in which case we *don't* want a null relation. This logic is encapsulated in the #null_scope? method. We also need to make sure that the CollectionProxy is not 'infected' with the NullRelation module, or else the methods from there will override the definitions in CollectionProxy, leading to incorrect results. Hence the nullify: false option to CollectionAssociation#scope. (This feels a bit nasty but I can't think of a better way.)
* improve NullRelation docs [ci skip]Vijay Dev2012-07-211-1/+0
|
* Fix typos and add nodocs to NullRelationOscar Del Ben2012-07-171-1/+1
|
* unused method argumentsAkira Matsuda2012-06-011-7/+6
|
* modulize AR::NullRelationAkira Matsuda2012-06-011-2/+2
| | | | now we can invoke previously added scope extension methods
* Override AR::Relation methods in NullRelation.Juanjo Bazán2012-04-111-0/+53
| | | So a NullRelation (Relation#none) is chainable with database methods.
* Added `none` query method to return zero records.Juanjo Bazán2012-01-311-0/+10
And added NullRelation class implementing the null object pattern for the `Relation` class.