Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Delegate all calculations to the scope. | Jon Leighton | 2012-11-09 | 1 | -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 Leighton | 2012-11-09 | 1 | -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 Dev | 2012-07-21 | 1 | -1/+0 |
| | |||||
* | Fix typos and add nodocs to NullRelation | Oscar Del Ben | 2012-07-17 | 1 | -1/+1 |
| | |||||
* | unused method arguments | Akira Matsuda | 2012-06-01 | 1 | -7/+6 |
| | |||||
* | modulize AR::NullRelation | Akira Matsuda | 2012-06-01 | 1 | -2/+2 |
| | | | | now we can invoke previously added scope extension methods | ||||
* | Override AR::Relation methods in NullRelation. | Juanjo Bazán | 2012-04-11 | 1 | -0/+53 |
| | | | So a NullRelation (Relation#none) is chainable with database methods. | ||||
* | Added `none` query method to return zero records. | Juanjo Bazán | 2012-01-31 | 1 | -0/+10 |
And added NullRelation class implementing the null object pattern for the `Relation` class. |