Method: Simple::SQL::Connection#scope

Defined in:
lib/simple/sql/connection/scope.rb

#scope(sql, args = []) ⇒ Object

Build a scope object

This call supports a few variants:

Simple::SQL.scope("SELECT * FROM mytable")
Simple::SQL.scope(table: "mytable", select: "*")

The second option also allows one to pass in more options, like the following:

Simple::SQL.scope(table: "mytable", select: "*", where: { id: 1, foo: "bar" }, order_by: "id desc")


21
22
23
# File 'lib/simple/sql/connection/scope.rb', line 21

def scope(sql, args = [])
  ::Simple::SQL::Connection::Scope.new sql, args, connection: self
end