Sha256: 32700ecdd6c1d3ddd2cd51c06bb63e93786f9a2a5c6a05000e1b290c4b679179

Contents?: true

Size: 763 Bytes

Versions: 22

Compression:

Stored size: 763 Bytes

Contents

module Arel
  ###
  # FIXME hopefully we can remove this
  module Crud
    def compile_update values, pk
      um = UpdateManager.new @engine

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

    def compile_insert values
      im = create_insert
      im.insert values
      im
    end

    def create_insert
      InsertManager.new @engine
    end

    def compile_delete
      dm = DeleteManager.new @engine
      dm.wheres = @ctx.wheres
      dm.from @ctx.froms
      dm
    end

  end
end

Version data entries

22 entries across 19 versions & 7 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/arel-6.0.4/lib/arel/crud.rb
arel-6.0.4 lib/arel/crud.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/arel-6.0.3/lib/arel/crud.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/crud.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/arel-5.0.1.20140414130214/lib/arel/crud.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/arel-5.0.1.20140414130214/lib/arel/crud.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/crud.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/arel-5.0.1.20140414130214/lib/arel/crud.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/arel-6.0.3/lib/arel/crud.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/arel-6.0.3/lib/arel/crud.rb
arel-6.0.3 lib/arel/crud.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/arel-6.0.0/lib/arel/crud.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/arel-6.0.0/lib/arel/crud.rb
arel-6.0.2 lib/arel/crud.rb
arel-6.0.1 lib/arel/crud.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/arel-6.0.0/lib/arel/crud.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/arel-6.0.0/lib/arel/crud.rb
arel-6.0.0 lib/arel/crud.rb
arel-6.0.0.beta2 lib/arel/crud.rb
arel-6.0.0.beta1 lib/arel/crud.rb