aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/named_scope_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* remove requires of core_ext/array/random_access that no longer existslest2011-12-211-1/+0
|
* call scope within unscoped to prevent duplication of where valuesSergey Nartimov2011-12-171-0/+5
|
* #first doesn't take an order in this testDamien Mathieu2011-09-061-1/+1
|
* first and last orders the records by idDamien Mathieu2011-09-061-2/+2
|
* Refactor test case to use anonymous class - Thank you @tenderlovePrem Sichanugrist2011-07-181-13/+8
|
* Raise an ArgumentError if user passing less number of argument in the ↵Prem Sichanugrist2011-07-171-0/+15
| | | | | | | | | | | | | dynamic finder The previous behavior was unintentional, and some people was relying on it. Now the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.) So if you were doing this and expecting the second argument to be nil: User.find_by_username_and_group("sikachu") You'll now get `ArgumentError: wrong number of arguments (1 for 2).` You'll then have to do this: User.find_by_username_and_group("sikachu", nil)
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Merge pull request #1462 from arunagw/test_added_for_namedscopeJosé Valim2011-06-051-0/+8
|\ | | | | Test added for namedscope target.
| * Test added for namedscope target.Arun Agrawal2011-06-031-0/+8
| |
* | Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
|/ | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Modified NamedScopeTest to use CollectionAssociation.Michael Ebens2011-05-111-1/+1
|
* Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via ↵Jon Leighton2011-04-171-6/+0
| | | | | | | | | | the scope class method. Just define a class method yourself instead." This reverts commit f0e198bfa1e3f9689e0cde1d194a44027fc90b3c. Conflicts: activerecord/test/models/post.rb
* Deprecate defining scopes with a callable (lambda, proc, etc) via the scope ↵Jon Leighton2011-04-121-0/+6
| | | | class method. Just define a class method yourself instead.
* ActiveRecord::Base.scopes hash is not neededJon Leighton2011-04-121-11/+0
|
* Removing the scope-caching which happens on association proxies, because the ↵Jon Leighton2011-04-121-10/+15
| | | | query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
* Delegate first!, last!, any? and many? to scopedAndrew White2011-03-291-1/+16
|
* fixes: ActiveRecord::Base.scopes includes all scopes defined in all subclassesEric Allam2011-02-241-0/+4
|
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-1/+1
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* Replace rudimentary named_scope with scope. [#6052 state:resolved]Pavel Gorbokon2010-12-151-21/+21
| | | | | | | * rename method names (actually in tests) * rename instance variable @_named_scopes_cache to @_scopes_cache * rename references in doc comments * don't touch CHANGELOG :)
* Models should be equals even after destroyedSantiago Pastorino2010-11-161-1/+1
| | | | [#5978 state:committed]
* scopes can take an object that responds to `call`Aaron Patterson2010-10-191-0/+6
|
* Cleanup deprecation warnings in active recordCarlos Antonio da Silva2010-09-061-4/+0
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-2/+2
| | | | better default failure messages - let's use them
* Dynamic finder method like scoped_by_* create methods so thatNeeraj Singh2010-08-031-0/+6
| | | | | | | method_missing is not hit next time. Adding a test for this scenario. Signed-off-by: José Valim <jose.valim@gmail.com>
* renaming tests by removing proxy_options from namesNeeraj Singh2010-07-211-5/+5
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Push a failing test for issues [#4994] and [#5003].José Valim2010-06-291-0/+6
|
* Add scoping and unscoped as the syntax to replace the old with_scope and ↵José Valim2010-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* removes Array#random_element and backports Array#sample from Ruby 1.9, ↵Xavier Noria2010-06-051-1/+1
| | | | thanks to Marc-Andre Lafortune
* Properly cache association_collection#scopes calls having argumentsPratik Naik2010-06-041-0/+13
|
* Change on Array extension from rand => random_element [#4555 state:committed]Santiago Pastorino2010-05-161-1/+1
| | | | Signed-off-by: Xavier Noria <fxn@hashref.com>
* STI should not ignore type condition while applying scopes from parent class ↵Neeraj Singh2010-05-151-0/+5
| | | | | | | | scopes [#4507 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Reset named scope cache whenever the @target is resetPratik Naik2010-04-071-0/+10
|
* Memoize association.named_scope callsPratik Naik2010-04-051-0/+9
|
* Named scopes shouldn't test equality using to_a if it's not an Array, this ↵Emilio Tagua2010-03-301-3/+9
| | | | | | 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-2/+15
| | | | | | | | | 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>
* cleaning up a bunch of parse time warnings in AR [#4186 state:resolved]Aaron Patterson2010-03-151-2/+2
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Allow calling class methods on a RelationPratik Naik2010-01-221-0/+9
|
* Give preference to to_a over arel from Relation#method_missingPratik Naik2010-01-191-0/+6
|
* Rename named_scope to scopePratik Naik2010-01-181-1/+5
|
* Inherit named scope class Scope from RelationPratik Naik2010-01-181-11/+6
|
* Ensure that Scope#proxy_scope is always klass. Rename proxy_scope to klass too.Pratik Naik2010-01-181-4/+4
|
* Make sure named_scope names are not used as method names alreadyPratik Naik2010-01-171-5/+11
|
* Add new finder methods to association collection.Pratik Naik2009-12-271-2/+2
|
* Merge commit 'rails/master'Emilio Tagua2009-08-101-0/+6
|\ | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/calculations.rb activerecord/lib/active_record/connection_adapters/mysql_adapter.rb activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
| * Prevent overwriting of table name in merging SQL conditions [#2949 ↵Tristan Dunn2009-08-101-0/+6
| | | | | | | | state:resolved]
* | Merge commit 'rails/master'Emilio Tagua2009-08-081-1/+2
|\| | | | | | | | | | | Conflicts: activerecord/test/cases/adapter_test.rb activerecord/test/cases/method_scoping_test.rb
| * always sort lists by id before comparison to avoid errors because of ↵Raimonds Simanovskis2009-08-061-1/+2
| | | | | | | | different sorting of same results (on Oracle database)
* | Merge commit 'rails/master'Emilio Tagua2009-07-311-4/+0
|\| | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * Revert "Methods invoked within named scope Procs should respect the scope ↵Jeremy Kemper2009-07-291-4/+0
| | | | | | | | | | | | | | | | | | | | stack. [#1267 state:resolved]" This reverts commit 6a13376525f34a00e013fc3a6022838329dfe856. Conflicts: activerecord/test/cases/named_scope_test.rb
* | Introduced ActiveRecord::Relation, a layer between an ARel relation and an ↵Emilio Tagua2009-07-211-4/+4
|/ | | | AR relation