Module: Thredded::ArelCompat

Defined in:
lib/thredded/arel_compat.rb

Class Method Summary collapse

Class Method Details

.integer_division(engine, a, b) ⇒ Arel::Nodes::Node

Returns a / b.

Parameters:

  • engine (#connection)
  • a (Arel::Nodes::Node)

    integer node

  • b (Arel::Nodes::Node)

    integer node

Returns:

  • (Arel::Nodes::Node)

    a / b



11
12
13
14
15
16
17
# File 'lib/thredded/arel_compat.rb', line 11

def integer_division(engine, a, b)
  if /mysql|mariadb/i.match?(engine.connection.adapter_name)
    Arel::Nodes::InfixOperation.new('DIV', a, b)
  else
    Arel::Nodes::Division.new(a, b)
  end
end