Module: Sequel::Postgres::IntervalDatasetMethods

Defined in:
lib/sequel/extensions/pg_interval.rb

Constant Summary collapse

CAST_INTERVAL =
'::interval'.freeze

Instance Method Summary collapse

Instance Method Details

#literal_other_append(sql, v) ⇒ Object

Handle literalization of ActiveSupport::Duration objects, treating them as PostgreSQL intervals.



180
181
182
183
184
185
186
187
188
# File 'lib/sequel/extensions/pg_interval.rb', line 180

def literal_other_append(sql, v)
  case v
  when ActiveSupport::Duration
    literal_append(sql, IntervalDatabaseMethods.literal_duration(v))
    sql << CAST_INTERVAL
  else
    super
  end
end