mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Ensure hm:t#find does not assign nil to :include [#1845 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
654568e71b
commit
076ca48bd6
2 changed files with 6 additions and 1 deletions
|
@ -54,7 +54,7 @@ module ActiveRecord
|
||||||
options[:select] = construct_select(options[:select])
|
options[:select] = construct_select(options[:select])
|
||||||
options[:from] ||= construct_from
|
options[:from] ||= construct_from
|
||||||
options[:joins] = construct_joins(options[:joins])
|
options[:joins] = construct_joins(options[:joins])
|
||||||
options[:include] = @reflection.source_reflection.options[:include] if options[:include].nil?
|
options[:include] = @reflection.source_reflection.options[:include] if options[:include].nil? && @reflection.source_reflection.options[:include]
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_record(record, force = true, validate = true)
|
def insert_record(record, force = true, validate = true)
|
||||||
|
|
|
@ -299,4 +299,9 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
|
||||||
def test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys
|
def test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys
|
||||||
assert_equal 1, owners(:blackbeard).toys.count
|
assert_equal 1, owners(:blackbeard).toys.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_on_has_many_association_collection_with_include_and_conditions
|
||||||
|
post_with_no_comments = people(:michael).posts_with_no_comments.first
|
||||||
|
assert_equal post_with_no_comments, posts(:authorless)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue