aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/spawn_methods.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-16 23:11:35 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-16 23:11:35 +0530
commit3968825f5ff6a75cb83400716d56ec10f261e41a (patch)
tree2a595291556ae52b920036e596fd2b7f257e4ab2 /activerecord/lib/active_record/relation/spawn_methods.rb
parentcfdfd899262c79c37ac89e030f4d90c8f9868b50 (diff)
downloadrails-3968825f5ff6a75cb83400716d56ec10f261e41a.tar.gz
rails-3968825f5ff6a75cb83400716d56ec10f261e41a.tar.bz2
rails-3968825f5ff6a75cb83400716d56ec10f261e41a.zip
Make sure Model#active_relation always adds STI conditions if needed
Diffstat (limited to 'activerecord/lib/active_record/relation/spawn_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/spawn_methods.rb4
1 files changed, 3 insertions, 1 deletions
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]).