Module: Torque::PostgreSQL::Arel::Operations

Included in:
Arel::Attributes::Attribute, Arel::Nodes::Node, Arel::Nodes::SqlLiteral
Defined in:
lib/torque/postgresql/arel/operations.rb,
sig/torque/postgresql/arel/operations.rbs

Instance Method Summary collapse

Instance Method Details

#cast(type, array = false) ⇒ Object

Make sure to add proper support over AR's own cast method while still allow attributes to be casted

Parameters:

  • type (column_ref)
  • array (bool, Symbol) (defaults to: false)

Returns:

  • (Object)


15
16
17
# File 'lib/torque/postgresql/arel/operations.rb', line 15

def cast(type, array = false)
  defined?(super) && !array ? super(type) : pg_cast(type, array)
end

#pg_cast(type, array = false) ⇒ Nodes::Cast

Create a cast operation

Parameters:

  • type (column_ref)
  • array (bool, Symbol) (defaults to: false)

Returns:



9
10
11
# File 'lib/torque/postgresql/arel/operations.rb', line 9

def pg_cast(type, array = false)
  Nodes::Cast.new(self, type, array)
end