module Arsi::ArelTreeManager

Public Instance Methods

where_sql(engine = ::Arel::Table.engine) click to toggle source

This is inspired from Arel::SelectManager, a subclass of Arel::TreeManager just like Arel::UpdateManager and Arel::DeleteManager.

# File lib/arsi/arel_tree_manager.rb, line 7
def where_sql(engine = ::Arel::Table.engine)
  return if @ast.wheres.empty?

  ::Arel::Nodes::SqlLiteral.new("WHERE #{::Arel::Nodes::And.new(@ast.wheres).to_sql(engine)}")
end