aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJohn Devine <johnjdevine@gmail.com>2008-05-04 14:08:19 -0500
committerPratik Naik <pratiknaik@gmail.com>2008-05-15 13:42:28 +0100
commitb28b54cab090bed8f099ef375b419a8f92390dd4 (patch)
treee697ac7a8585f48ee92d39f6eaf102e3c63692cf /activerecord/test
parent6df995bbf2f0fcb26b7a1ba8d4e41ed9de77b6c8 (diff)
downloadrails-b28b54cab090bed8f099ef375b419a8f92390dd4.tar.gz
rails-b28b54cab090bed8f099ef375b419a8f92390dd4.tar.bz2
rails-b28b54cab090bed8f099ef375b419a8f92390dd4.zip
Make sure needed table joins are included :select option. [#110 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/finder_test.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 2acfe9b387..d3e2f33f99 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -859,12 +859,15 @@ class FinderTest < ActiveRecord::TestCase
end
def test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct
- assert_equal 2, Post.find(:all,:include=>{:authors=>:author_address},:order=>' author_addresses.id DESC ', :limit=>2).size
+ assert_equal 2, Post.find(:all, :include => { :authors => :author_address }, :order => ' author_addresses.id DESC ', :limit => 2).size
- assert_equal 3, Post.find(:all,:include=>{:author=>:author_address,:authors=>:author_address},
- :order=>' author_addresses_authors.id DESC ', :limit=>3).size
+ assert_equal 3, Post.find(:all, :include => { :author => :author_address, :authors => :author_address},
+ :order => ' author_addresses_authors.id DESC ', :limit => 3).size
end
+ def test_with_limiting_with_custom_select
+ assert_equal 3, Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3).size
+ end
protected
def bind(statement, *vars)