diff options
author | josevalim <jose.valim@gmail.com> | 2008-05-23 11:20:13 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-05-24 17:58:03 +1200 |
commit | 8d0b4fa39fab6e5d1e3382b4b137cc47e559b0be (patch) | |
tree | 06a4ff2e8bbb4646082fd627ed6633d79a4ee949 /activerecord/test/cases/associations | |
parent | 5b8d0f134a5766aa1b3d0945b79f04d2bb911c02 (diff) | |
download | rails-8d0b4fa39fab6e5d1e3382b4b137cc47e559b0be.tar.gz rails-8d0b4fa39fab6e5d1e3382b4b137cc47e559b0be.tar.bz2 rails-8d0b4fa39fab6e5d1e3382b4b137cc47e559b0be.zip |
Added :select option to has_one and belongs_to, remove unused :order option on belongs_to.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#241 state:resolved]
Diffstat (limited to 'activerecord/test/cases/associations')
-rwxr-xr-x[-rw-r--r--] | activerecord/test/cases/associations/belongs_to_associations_test.rb | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | activerecord/test/cases/associations/has_one_associations_test.rb | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 4382ba17ef..3073eae355 100644..100755 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -92,6 +92,11 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_not_nil Company.find(3).firm_with_condition, "Microsoft should have a firm" end + def test_with_select + assert_equal Company.find(2).firm_with_select.attributes.size, 1 + assert_equal Company.find(2, :include => :firm_with_select ).firm_with_select.attributes.size, 1 + end + def test_belongs_to_counter debate = Topic.create("title" => "debate") assert_equal 0, debate.send(:read_attribute, "replies_count"), "No replies yet" diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 9e99caa7b7..e7d4de8246 100644..100755 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -24,6 +24,11 @@ class HasOneAssociationsTest < ActiveRecord::TestCase assert_queries(0) { firms.each(&:account) } end + def test_with_select + assert_equal Firm.find(1).account_with_select.attributes.size, 2 + assert_equal Firm.find(1, :include => :account_with_select).attributes.size, 2 + end + def test_can_marshal_has_one_association_with_nil_target firm = Firm.new assert_nothing_raised do |