Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6461: has_many_through_STI_subclasses_fix_for_6461.patch

File has_many_through_STI_subclasses_fix_for_6461.patch, 1.0 kB (added by mhoroschun, 1 year ago)
  • activerecord/lib/active_record/associations/has_many_through_association.rb

    old new  
    227227             
    228228            conditions = '' 
    229229            # Add filter for single-table inheritance, if applicable. 
    230             conditions += " AND #{remote_table_alias}.#{association_class.inheritance_column} = #{association_class.quote_value(association_class.name.demodulize)}" unless association_class.descends_from_active_record? 
     230            conditions += " AND #{association_class.send(:type_condition)}" unless association_class.descends_from_active_record? 
    231231            # Add custom conditions 
    232232            conditions += " AND (#{interpolate_sql(association_class.send(:sanitize_sql, reflection.options[:conditions]))})" if reflection.options[:conditions] 
    233233