aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
Commit message (Collapse)AuthorAgeFilesLines
* adding a reader for loaded, initializing @loaded to falseAaron Patterson2010-07-201-1/+1
|
* Make use of redefine_method, removed some more redefining warningsŁukasz Strzałkowski2010-07-191-1/+1
|
* Make relation a private method.José Valim2010-07-011-1/+1
|
* Add scoping and unscoped as the syntax to replace the old with_scope and ↵José Valim2010-06-291-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* All scopes are now cross-referenced.Rizwan Reza2010-06-211-4/+4
|
* Adds backslash to scope for cross-references.Rizwan Reza2010-06-161-1/+1
|
* Adds title and minor changes.Rizwan Reza2010-06-161-4/+7
|
* STI should not ignore type condition while applying scopes from parent class ↵Neeraj Singh2010-05-151-5/+1
| | | | | | | | scopes [#4507 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* moves Object#singleton_class to Kernel#singleton_class to match Ruby also ↵Xavier Noria2010-04-051-1/+1
| | | | there, same for #class_eval to simplify, and adds coverage for class_eval
* Improve scope docsPratik Naik2010-04-031-30/+14
|
* Improve named scope lambdaPratik Naik2010-04-031-13/+4
|
* Remove unnecessary argument for creating scopesPratik Naik2010-04-031-4/+4
|
* Goodbye ActiveRecord::NamedScope::ScopePratik Naik2010-04-021-35/+17
|
* Make Relation#first and Relation#last behave like named scope'sPratik Naik2010-04-021-16/+0
|
* Scope#method_missing can safely rely on Relation#method_missingPratik Naik2010-04-021-10/+0
|
* Scope#current_scoped_methods_when_defined is no longer neededPratik Naik2010-04-021-13/+2
|
* Add Relation extensionsPratik Naik2010-04-021-5/+2
|
* Named scopes shouldn't test equality using to_a if it's not an Array, this ↵Emilio Tagua2010-03-301-1/+8
| | | | | | was causing records to be loaded before they were needed. Signed-off-by: José Valim <jose.valim@gmail.com>
* defining a named_scope which overwrites an existing method is now allowed we ↵Matthew Rudy Jacobs2010-03-281-1/+2
| | | | | | | | | just log a warning. This was motivated by the fact that :open is defined on all classes as such the named_scope "open" can never be used, without hacking ActiveRecord with an "undef_method" [#4083 state:resolved] Signed-off-by: wycats <wycats@gmail.com>
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+1
|
* removing spawn from SpawnMethodsAaron Patterson2010-03-101-1/+1
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Use Object#singleton_class instead of #metaclass. Prefer Ruby's choice.Jeremy Kemper2010-02-251-2/+2
|
* Fix AP's AR integration tests warningPratik Naik2010-01-201-1/+1
|
* Scope#find is no longer needed now that Relation#find handles all the casesPratik Naik2010-01-201-12/+0
|
* Named scopes dont need count() now that Relation#count handles all the casesPratik Naik2010-01-201-5/+0
|
* Fix the named scope equality checkPratik Naik2010-01-191-1/+1
|
* Cleanup deprecation notices.Joshua Peek2010-01-181-4/+4
|
* Forgot to change named_scope to scope in an ArgumentError raise exception ↵Paco Guzman2010-01-181-1/+1
| | | | | | for duplication scopes related to commit d60bb0a9e4be [#3736 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix the named_scope deprecation noticePratik Naik2010-01-181-1/+1
|
* Rename named_scope to scopePratik Naik2010-01-181-7/+12
|
* Inherit named scope class Scope from RelationPratik Naik2010-01-181-76/+42
|
* Ensure that Scope#proxy_scope is always klass. Rename proxy_scope to klass too.Pratik Naik2010-01-181-22/+16
|
* Make relations work as scopesPratik Naik2010-01-171-5/+21
|
* Make sure named_scope names are not used as method names alreadyPratik Naik2010-01-171-0/+5
|
* Use relations to build scope for named scopesPratik Naik2010-01-171-2/+7
|
* Simplify Model.scoped definitionPratik Naik2010-01-171-7/+1
|
* Rename Model.active_relation to Model.unscopedPratik Naik2010-01-171-1/+1
|
* Make sure Model#active_relation always adds STI conditions if neededPratik Naik2010-01-161-1/+1
|
* Make scopes use relations under the hoodPratik Naik2010-01-161-2/+4
|
* Get rid of Model.construct_finder_arel_with_includes. Use ↵Pratik Naik2010-01-031-1/+1
| | | | construct_finder_arel instead
* Rename Model.arel_table to Model.active_relationPratik Naik2010-01-021-1/+1
|
* Rename Model.engine to active_relation_engine. Cache arel_table and the ↵Pratik Naik2010-01-021-1/+1
| | | | method takes no arguments now
* Make Model.find_by_* and Model.find_all_by_* use relations and remove ↵Pratik Naik2009-12-271-15/+3
| | | | dynamic method caching
* Ensure Model.scoped adds type conditions for STI modelsPratik Naik2009-12-271-0/+1
|
* Add Model.select/group/order/limit/joins/conditions/preload/eager_load class ↵Pratik Naik2009-12-261-1/+20
| | | | | | | | | methods returning a lazy relation. Examples : posts = Post.select('id).order('name') # Returns a lazy relation posts.each {|p| puts p.id } # Fires "select id from posts order by name"
* Model.scoped now returns a relation if invoked without any argumentsPratik Naik2009-12-261-11/+19
| | | | | | | | Example : posts = Post.scoped posts.size # Fires "select count(*) from posts" and returns the count posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects
* Revert "Methods invoked within named scope Procs should respect the scope ↵Jeremy Kemper2009-07-291-6/+1
| | | | | | | | | | stack. [#1267 state:resolved]" This reverts commit 6a13376525f34a00e013fc3a6022838329dfe856. Conflicts: activerecord/test/cases/named_scope_test.rb
* uses Object#metaclass and Object#class_eval in a few spotsXavier Noria2009-06-121-1/+2
| | | | | | [#2797 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Break up DependencyModule's dual function of providing a "depend_on" DSL and ↵Joshua Peek2009-05-281-1/+1
| | | | "included" block DSL into separate modules. But, unify both approaches under AS::Concern.
* Implement #many? for NamedScope and AssociationCollection using #size [#1500 ↵Chris Kampmeier2009-05-171-1/+10
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>