module Sequel::Plugins::PgRow::DatabaseMethods

  1. lib/sequel/extensions/_model_pg_row.rb

Methods

Public Instance

  1. bound_variable_arg
  2. row_type

Public Instance methods

bound_variable_arg(arg, conn)

Handle Sequel::Model instances in bound variables.

[show source]
   # File lib/sequel/extensions/_model_pg_row.rb
 8 def bound_variable_arg(arg, conn)
 9   case arg
10   when Sequel::Model
11     "(#{arg.values.values_at(*arg.columns).map{|v| bound_variable_array(v)}.join(',')})"
12   else
13     super
14   end
15 end
row_type(db_type, v)

If a Sequel::Model instance is given, return it as-is instead of attempting to convert it.

[show source]
   # File lib/sequel/extensions/_model_pg_row.rb
19 def row_type(db_type, v)
20   if v.is_a?(Sequel::Model)
21     v
22   else
23     super
24   end
25 end