aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Delegate ActiveRecord::Base.offset to scoped methods (analogous to limit) ↵Marcelo Giorgi2010-09-241-0/+6
| | | | | | [#5688 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* removing nonsensical tests, limit now actually adds a limitAaron Patterson2010-09-151-1/+1
|
* failing test for reorder overriding default_scopeNick Ragaz2010-09-051-0/+6
| | | | | | [5528] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* order should always be concatenated.Neeraj Singh2010-09-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | order that is declared first has highest priority in all cases. Here are some examples. Car.order('name desc').find(:first, :order => 'id').name Car.named_scope_with_order.named_scope_with_another_order Car.order('id DESC').scoping do Car.find(:first, :order => 'id asc') end No special treatment to with_scope or scoping. Also note that if default_scope declares an order then the order declared in default_scope has the highest priority unless with_exclusive_scope is used. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Change relation merging to always append select, group and order valuesPratik Naik2010-08-311-6/+7
|
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-1/+1
| | | | better default failure messages - let's use them
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)
* Ensure default_scope can be overwriten by association conditions.José Valim2010-07-211-0/+5
|
* eagerly loaded association records should respect default_scope [#2931 ↵Subba Rao Pasupuleti2010-07-211-2/+16
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Added reorder delegation for ActiveRecord::Base(to be able to overwrite the ↵Vitalii Khustochka2010-07-131-0/+6
| | | | | | default_scope ordering in the named scope [#5093 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add scoping and unscoped as the syntax to replace the old with_scope and ↵José Valim2010-06-291-0/+396
with_exclusive_scope. A few examples: * with_scope now should be scoping: Before: Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end After: Comment.where(:post_id => 1).scoping do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end * with_exclusive_scope now should be unscoped: class Post < ActiveRecord::Base default_scope :published => true end Post.all #=> SELECT * FROM posts WHERE published = true Before: Post.with_exclusive_scope do Post.all #=> SELECT * FROM posts end After: Post.unscoped do Post.all #=> SELECT * FROM posts end Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values: Post.unscoped.all #=> SELECT * FROM posts