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

Ticket #1732: habtm_finder_sql_fix.2.diff

File habtm_finder_sql_fix.2.diff, 0.8 kB (added by rtomayko@gmail.com, 3 years ago)

Updated version of patch (the old one failed to apply)

  • activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb

    old new  
    136136        end 
    137137 
    138138        def construct_sql 
    139           interpolate_sql_options!(@options, :finder_sql) 
    140  
    141139          if @options[:finder_sql] 
    142             @finder_sql = @options[:finder_sql] 
     140            @finder_sql = interpolate_sql(@options[:finder_sql]) 
    143141          else 
    144142            @finder_sql = "#{@join_table}.#{@association_class_primary_key_name} = #{@owner.quoted_id} " 
    145143            @finder_sql << " AND (#{interpolate_sql(@options[:conditions])})" if @options[:conditions]