Sha256: c4f5ecf488ee6c91df883cec614bdc8b585d84e7178a638e511c5c8c5851121b

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

# frozen_string_literal: true

module Thredded
  module ArelCompat
    module_function

    # @param [#connection] engine
    # @param [Arel::Nodes::Node] a integer node
    # @param [Arel::Nodes::Node] b integer node
    # @return [Arel::Nodes::Node] a / b
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thredded-1.1.0 lib/thredded/arel_compat.rb
thredded-1.0.1 lib/thredded/arel_compat.rb