1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

ActiveRecord::Base.joins should allow single nil argument [#6181 state:resolved]

This commit is contained in:
Piotr Sarnacki 2010-12-16 22:20:42 +01:00
parent e89fff2f6b
commit 40b15f9f38
2 changed files with 5 additions and 1 deletions

View file

@ -63,7 +63,7 @@ module ActiveRecord
end
def joins(*args)
return self if args.blank?
return self if args.compact.blank?
relation = clone

View file

@ -184,6 +184,10 @@ class RelationTest < ActiveRecord::TestCase
assert_equal [2, 4, 6, 8, 10], even_ids.sort
end
def test_joins_with_nil_argument
assert_nothing_raised { DependentFirm.joins(nil).first }
end
def test_finding_with_hash_conditions_on_joined_table
firms = DependentFirm.joins(:account).where({:name => 'RailsCore', :accounts => { :credit_limit => 55..60 }}).to_a
assert_equal 1, firms.size