Module: FatJam::QuotedColumnConditions::ClassMethods

Defined in:
lib/acts_as_revisable/quoted_columns.rb

Instance Method Summary collapse

Instance Method Details

#quote_bound_value_with_quoted_column(value) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/acts_as_revisable/quoted_columns.rb', line 23

def quote_bound_value_with_quoted_column(value)
  if value.is_a?(Symbol) && column_names.member?(value.to_s)
    # code borrowed from sanitize_sql_hash_for_conditions
    attr = value.to_s
    table_name = quoted_table_name
    
    return "#{table_name}.#{connection.quote_column_name(attr)}"
  end
  
  quote_bound_value_without_quoted_column(value)
end