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
Tarmo Tänav (committer)
Sun Aug 24 09:26:57 -0700 2008
commit  c3aad223321d1897c9e2269b32c3c2da7af814d1
tree    9bf32913be6103f8b60ebc2ca380e5733573eb17
parent  82e6e48af1634978156320a14cb520ca859725e3
...
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