public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Make sure association preloading works with full STI class name [#465 
state:Resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Joachim Garth (author)
Fri Jun 27 11:03:51 -0700 2008
lifo (committer)
Thu Jul 17 19:44:44 -0700 2008
commit  a1fcbd971d681e44de5ea33e6a8470ff8b8144c0
tree    6fbcb336c3ce34c20f77e7a60432132d28c86965
parent  1e0f94a77c717dd06a86edda97de5a4c4ad919a8
...
252
253
254
255
 
256
257
258
...
252
253
254
 
255
256
257
258
0
@@ -252,7 +252,7 @@ module ActiveRecord
0
         table_name = reflection.klass.quoted_table_name
0
 
0
         if interface = reflection.options[:as]
0
-          conditions = "#{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_id"} IN (?) and #{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_type"} = '#{self.base_class.name.demodulize}'"
0
+          conditions = "#{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_id"} IN (?) and #{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_type"} = '#{self.base_class.sti_name}'"
0
         else
0
           foreign_key = reflection.primary_key_name
0
           conditions = "#{reflection.klass.quoted_table_name}.#{foreign_key} IN (?)"

Comments