Module: Thredded::ArelCompat

Defined in:
lib/thredded/arel_compat.rb

Class Method Summary collapse

Instance 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


42
43
44
45
46
47
48
# File 'lib/thredded/arel_compat.rb', line 42

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

Instance Method Details

#pluck(relation, *columns) ⇒ Object


21
22
23
# File 'lib/thredded/arel_compat.rb', line 21

def pluck(relation, *columns)
  relation.pluck(*columns)
end

#true_value(engine) ⇒ Object


51
52
53
# File 'lib/thredded/arel_compat.rb', line 51

def true_value(_engine)
  true
end