aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorDaniel Guettler <daniel.guettler@gmail.com>2008-07-21 15:21:13 -0400
committerPratik Naik <pratiknaik@gmail.com>2008-07-22 01:24:47 +0100
commitc67713a2fe78d6f2db49b09771841f5022995703 (patch)
tree7a12fd34af595a3712889d9a2d3264c84279f692 /activerecord/lib/active_record/associations.rb
parent89ec72c2818a592323fe4ec3277638d379f1ac2a (diff)
downloadrails-c67713a2fe78d6f2db49b09771841f5022995703.tar.gz
rails-c67713a2fe78d6f2db49b09771841f5022995703.tar.bz2
rails-c67713a2fe78d6f2db49b09771841f5022995703.zip
Use klass.sti_name to make sure associations take store_full_sti_class into account. [#671 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index fd9a443eb9..d916275ab9 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1884,7 +1884,7 @@ module ActiveRecord
jt_sti_extra = " AND %s.%s = %s" % [
connection.quote_table_name(aliased_join_table_name),
connection.quote_column_name(through_reflection.active_record.inheritance_column),
- through_reflection.klass.quote_value(through_reflection.klass.name.demodulize)]
+ through_reflection.klass.quote_value(through_reflection.klass.sti_name)]
end
when :belongs_to
first_key = primary_key
@@ -1952,7 +1952,7 @@ module ActiveRecord
join << %(AND %s.%s = %s ) % [
connection.quote_table_name(aliased_table_name),
connection.quote_column_name(klass.inheritance_column),
- klass.quote_value(klass.name.demodulize)] unless klass.descends_from_active_record?
+ klass.quote_value(klass.sti_name)] unless klass.descends_from_active_record?
[through_reflection, reflection].each do |ref|
join << "AND #{interpolate_sql(sanitize_sql(ref.options[:conditions]))} " if ref && ref.options[:conditions]