aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-05 22:32:49 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-05 22:32:49 +0000
commitb7f1b3641afe0ff4f3cd344815c6f7bb58821e9e (patch)
tree34558d5f8832fd7ddc37d1950bdb1600f5b27d97 /activerecord/lib/active_record/base.rb
parent7fddb942624478a23173dfa379f7ade6a0fc9218 (diff)
downloadrails-b7f1b3641afe0ff4f3cd344815c6f7bb58821e9e.tar.gz
rails-b7f1b3641afe0ff4f3cd344815c6f7bb58821e9e.tar.bz2
rails-b7f1b3641afe0ff4f3cd344815c6f7bb58821e9e.zip
Use Base#type_condition in JoinAssociation
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b3204b2bda..baf82bedd3 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -973,8 +973,8 @@ module ActiveRecord #:nodoc:
relation
end
- def type_condition
- sti_column = arel_table[inheritance_column.to_sym]
+ def type_condition(table = arel_table)
+ sti_column = table[inheritance_column.to_sym]
sti_names = ([self] + descendants).map { |model| model.sti_name }
sti_column.in(sti_names)