Module: Arel::Crud

### Home Classes Methods

### In Files

- lib/arel/crud.rb

### Methods

- #compile_delete
- #compile_insert
- #compile_update
- #create_insert
- #delete
- #insert
- #update

### Files

- History.txt
- MIT-LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Arel
- Arel::AliasPredication
- Arel::Attributes
- Arel::Attributes::Attribute
- Arel::Attributes::Boolean
- Arel::Attributes::Decimal
- Arel::Attributes::Float
- Arel::Attributes::Integer
- Arel::Attributes::String
- Arel::Attributes::Time
- Arel::Attributes::Undefined
- Arel::Crud
- Arel::DeleteManager
- Arel::Expression
- Arel::Expressions
- Arel::FactoryMethods
- Arel::InsertManager
- Arel::Math
- Arel::Nodes
- Arel::Nodes::Addition
- Arel::Nodes::And
- Arel::Nodes::Ascending
- Arel::Nodes::Binary
- Arel::Nodes::BindParam
- Arel::Nodes::Count
- Arel::Nodes::CurrentRow
- Arel::Nodes::DeleteStatement
- Arel::Nodes::Descending
- Arel::Nodes::Distinct
- Arel::Nodes::Division
- Arel::Nodes::Equality
- Arel::Nodes::Extract
- Arel::Nodes::False
- Arel::Nodes::Following
- Arel::Nodes::Function
- Arel::Nodes::In
- Arel::Nodes::InfixOperation
- Arel::Nodes::InnerJoin
- Arel::Nodes::InsertStatement
- Arel::Nodes::JoinSource
- Arel::Nodes::Multiplication
- Arel::Nodes::NamedFunction
- Arel::Nodes::NamedWindow
- Arel::Nodes::Node
- Arel::Nodes::Ordering
- Arel::Nodes::OuterJoin
- Arel::Nodes::Over
- Arel::Nodes::Preceding
- Arel::Nodes::Range
- Arel::Nodes::Rows
- Arel::Nodes::SelectCore
- Arel::Nodes::SelectStatement
- Arel::Nodes::SqlLiteral
- Arel::Nodes::StringJoin
- Arel::Nodes::Subtraction
- Arel::Nodes::TableAlias
- Arel::Nodes::True
- Arel::Nodes::Unary
- Arel::Nodes::UnqualifiedColumn
- Arel::Nodes::UpdateStatement
- Arel::Nodes::Values
- Arel::Nodes::Window
- Arel::Nodes::With
- Arel::Nodes::WithRecursive
- Arel::OrderPredications
- Arel::Predications
- Arel::Relation
- Arel::SelectManager
- Arel::Sql
- Arel::Sql::Engine
- Arel::SqlLiteral
- Arel::Table
- Arel::TreeManager
- Arel::UpdateManager
- Arel::Visitors
- Arel::Visitors::BindVisitor
- Arel::Visitors::DepthFirst
- Arel::Visitors::Dot
- Arel::Visitors::IBM_DB
- Arel::Visitors::Informix
- Arel::Visitors::JoinSql
- Arel::Visitors::MSSQL
- Arel::Visitors::MySQL
- Arel::Visitors::Oracle
- Arel::Visitors::OrderClauses
- Arel::Visitors::PostgreSQL
- Arel::Visitors::SQLite
- Arel::Visitors::ToSql
- Arel::Visitors::Visitor
- Arel::Visitors::WhereSql
- Arel::WindowPredications

No matching classes.

# Arel::Crud

FIXME hopefully we can remove this

### Public Instance Methods

compile_delete() click to toggle source

    # File lib/arel/crud.rb, line 55
    def compile_delete
      dm = DeleteManager.new @engine
      dm.wheres = @ctx.wheres
      dm.from @ctx.froms
      dm
    end

compile_insert(values) click to toggle source

    # File lib/arel/crud.rb, line 34
    def compile_insert values
      im = create_insert
      im.insert values
      im
    end

compile_update(values) click to toggle source

    # File lib/arel/crud.rb, line 5
    def compile_update values
      um = UpdateManager.new @engine

      if Nodes::SqlLiteral === values
        relation = @ctx.from
      else
        relation = values.first.first.relation
      end
      um.table relation
      um.set values
      um.take @ast.limit.expr if @ast.limit
      um.order(*@ast.orders)
      um.wheres = @ctx.wheres
      um
    end

create_insert() click to toggle source

    # File lib/arel/crud.rb, line 40
    def create_insert
      InsertManager.new @engine
    end

delete() click to toggle source

    # File lib/arel/crud.rb, line 62
    def delete
      if $VERBOSE
        warn delete (#{caller.first}) is deprecated and will be removed in ARel 4.0.0. Pleaseswitch to `compile_delete`
      end
      @engine.connection.delete compile_delete.to_sql, 'AREL'
    end

insert(values) click to toggle source

FIXME: this method should go away

    # File lib/arel/crud.rb, line 45
    def insert values
      if $VERBOSE
        warn insert (#{caller.first}) is deprecated and will be removed in ARel 4.0.0. Pleaseswitch to `compile_insert`
      end
      @engine.connection.insert compile_insert(values).to_sql
    end

update(values) click to toggle source

FIXME: this method should go away

    # File lib/arel/crud.rb, line 22
    def update values
      if $VERBOSE
        warn update (#{caller.first}) is deprecated and will be removed in ARel 4.0.0. Pleaseswitch to `compile_update`
      end

      um = compile_update values
      @engine.connection.update um.to_sql, 'AREL'
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.