Permalink
Browse files

Ensure hm:t#find does not assign nil to :include [#1845 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent d1202cf commit 80d8608102cce64805e7573f6b97d8561f7f11ea @railsbob railsbob committed with lifo Aug 9, 2009
@@ -44,7 +44,7 @@ def construct_find_options!(options)
options[:select] = construct_select(options[:select])
options[:from] ||= construct_from
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
def insert_record(record, force = true, validate = true)
@@ -276,4 +276,9 @@ def test_has_many_association_through_a_belongs_to_association
def test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys
assert_equal 1, owners(:blackbeard).toys.count
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

0 comments on commit 80d8608

Please sign in to comment.