From 3968825f5ff6a75cb83400716d56ec10f261e41a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 16 Jan 2010 23:11:35 +0530 Subject: Make sure Model#active_relation always adds STI conditions if needed --- activerecord/lib/active_record/relation/spawn_methods.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation') diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 59cfca85ae..33df8fd06c 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -94,7 +94,9 @@ module ActiveRecord def apply_finder_options(options) options.assert_valid_keys(VALID_FIND_OPTIONS) - relation = joins(options[:joins]). + relation = spawn + + relation = relation.joins(options[:joins]). where(options[:conditions]). select(options[:select]). group(options[:group]). -- cgit v1.2.3