aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* reorder removed in favor of except(:order).orderSantiago Pastorino2010-10-111-6/+0
|
* @klass also uses DynamicFinderMatch, so no need for it on the relationAaron Patterson2010-09-271-0/+5
|
* expanding the test to include both type of order declarationNeeraj Singh2010-09-181-6/+22
| | | | | | | | | while declaring default_scope Also added test for unscoped using block style with four different combinations Signed-off-by: José Valim <jose.valim@gmail.com>
* removing nonsensical tests, limit now actually adds a limitAaron Patterson2010-09-151-4/+0
|
* added a test for relation which checks intersection between a relation and ↵kane2010-09-101-0/+6
| | | | | | an array works in both directions Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
* Add tests for Relation#only.Emilio Tagua2010-09-091-0/+11
|
* select should raise error when no block or no parameter is passedAaron Patterson2010-09-071-0/+4
|
* order should always be concatenated.Neeraj Singh2010-09-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | 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>
* Fix test: this should return 0 not 7, since Arel was ignoring select clause ↵Emilio Tagua2010-09-011-1/+1
| | | | | | and now it's fixed. 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
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)
* Ensure we can nest include calls [#5285 state:resolved]Neeraj Singh2010-08-121-1/+11
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* test to ensure that respond_to? delegates to arelAaron Patterson2010-08-061-0/+19
|
* sorry AR, my privates are none of your businessAaron Patterson2010-08-061-7/+0
|
* reverting where() functionality, adding a testAaron Patterson2010-07-301-0/+5
|
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-1/+0
| | | | | | [#5153 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* blocks removed from all the ActiveRelation query_methods, extend method ↵Santiago Pastorino2010-06-261-1/+1
| | | | | | added instead Signed-off-by: José Valim <jose.valim@gmail.com>
* reorder method added to ActiveRelationSantiago Pastorino2010-06-261-0/+6
| | | | | | [#4972 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Test for concatenated orders addedSantiago Pastorino2010-06-261-0/+6
| | | | | | [#4972] Signed-off-by: José Valim <jose.valim@gmail.com>
* Support for multiple selects addedNeeraj Singh and Santiago Pastorino2010-06-251-0/+6
| | | | [#4841 state:committed]
* Add tests for relation count. Fix other tests that were conceptually wrong.Emilio Tagua2010-06-241-1/+5
| | | | | | [#4882 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* adding fix for to_xml for ActiveRecord relation objectNeeraj Singh2010-06-231-0/+5
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* ActiveRecord's relation object should respond to to_json and to_yamlNeeraj Singh2010-06-231-0/+10
| | | | | | [#4547 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* test for #4917Neeraj Singh2010-06-221-0/+7
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix order method to accept relation attributes.Emilio Tagua2010-06-221-2/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* This test shouldn't rely on the order of the data returned by selectSantiago Pastorino2010-06-071-1/+1
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Special treatement for Relation#select { with block }Pratik Naik2010-06-021-0/+5
|
* Final iteration of use better testing methodsNeeraj Singh2010-05-191-3/+3
| | | | | | [#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add Relation extensionsPratik Naik2010-04-021-0/+16
|
* Relation should respond to class methodsPratik Naik2010-01-221-0/+5
|
* Handle invalid query IN() generated when a blank array is supplied in hash ↵Pratik Naik2010-01-181-0/+5
| | | | conditions
* Dont check for class equaity when merging relationsPratik Naik2010-01-181-4/+0
|
* Make Relation#reload force load the records immediatelyPratik Naik2010-01-171-3/+5
|
* Add Relation#create_with to explictily specify create scopePratik Naik2010-01-041-0/+8
|
* Relation#merge and Relation#except should respect locksPratik Naik2010-01-031-0/+5
|
* Add Relation#exceptPratik Naik2010-01-031-0/+12
|
* Give preference to the second relation's order when mergingPratik Naik2010-01-031-1/+0
|
* Add Relation#includes to be an equivalent of current finder option :includePratik Naik2010-01-031-1/+24
|
* Implement Relation#create and Relation#create!Pratik Naik2010-01-031-0/+24
|
* Implement Relation#newPratik Naik2010-01-031-0/+16
|
* Relation#many? shoud load the records if there's a LIMITPratik Naik2009-12-301-0/+6
|
* Add Relation#any? and Relation#many?Pratik Naik2009-12-301-0/+26
|
* Fix the count test for postgresPratik Naik2009-12-301-1/+1
|
* Relation#count should look for projections in chained relations and perform ↵Emilio Tagua2009-12-301-1/+11
| | | | | | the count on the given column Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Relation#respond_to? should take second argument for responding to private ↵Pratik Naik2009-12-291-0/+7
| | | | methods
* Make sure Relation responds to dynamic finder methodsPratik Naik2009-12-291-1/+9
|
* Add Relation#size and Relation#empty?Pratik Naik2009-12-291-3/+15
|
* Add Relation#delete_allPratik Naik2009-12-291-0/+20
|
* Add Relation#countPratik Naik2009-12-281-0/+30
|