Module: AssociateJsonb::PredicateBuilder

Defined in:
lib/associate_jsonb/predicate_builder.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#build_bind_attribute(column_name, value) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/associate_jsonb/predicate_builder.rb', line 6

def build_bind_attribute(column_name, value)
  if value.respond_to?(:value_before_type_cast)
    attr = ActiveRecord::Relation::QueryAttribute.new(column_name.to_s, value.value_before_type_cast, table.type(column_name), value)
  else
    attr = ActiveRecord::Relation::QueryAttribute.new(column_name.to_s, value, table.type(column_name))
  end
  Arel::Nodes::BindParam.new(attr)
end