Skip to content

Commit

Permalink
Use AR::Base.type_condition to construct conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Jun 1, 2009
1 parent 45500a3 commit 81add46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/nested_has_many_through.rb
Expand Up @@ -105,8 +105,8 @@ def construct_has_many_or_belongs_to_attributes(reflection, association_class, t
end

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

Expand Down

0 comments on commit 81add46

Please sign in to comment.