aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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