Permalink
Browse files

Merge pull request #1 from camwest/master

Newer versions of Rails call methods in a different way.
  • Loading branch information...
2 parents 2be2d83 + c19d57b commit 97066feeba0bd40cb6c91f55e8dba0ce034ceb2e @awd committed Aug 17, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/nested_has_many_through.rb
@@ -74,7 +74,7 @@ def construct_has_many_through_attributes(reflection, table_ids)
# Any subsequent joins / filters on owner attributes will act on the through association,
# so that's what we return for the conditions/keys of the overall association.
conditions = through_attrs[:conditions]
- conditions += " AND #{interpolate_sql(reflection.klass.send(:sanitize_sql, reflection.options[:conditions]))}" if reflection.options[:conditions]
+ conditions += " AND #{interpolate_and_sanitize_sql(reflection.options[:conditions])}" if reflection.options[:conditions]
{
:joins => "%s INNER JOIN %s ON ( %s = %s.%s %s) %s %s" % [
@@ -115,7 +115,7 @@ def construct_has_many_or_belongs_to_attributes(reflection, association_class, t
# Add type_condition, if applicable
conditions += " AND #{association_class.send(:type_condition).to_sql}" if association_class.finder_needs_type_condition?
# Add custom conditions
- conditions += " AND (#{interpolate_sql(association_class.send(:sanitize_sql, reflection.options[:conditions]))})" if reflection.options[:conditions]
+ conditions += " AND (#{interpolate_and_sanitize_sql(reflection.options[:conditions])})" if reflection.options[:conditions]
if reflection.macro == :belongs_to
if reflection.options[:polymorphic]

0 comments on commit 97066fe

Please sign in to comment.