Module: DataMapper::Adapters::DataObjectsAdapterAdjust

### Home Classes Methods

### In Files

- lib/dm-adjust/adapters/data_objects_adapter.rb

### Namespace

- MODULE DataMapper::Adapters::DataObjectsAdapterAdjust::SQL

### Methods

- #adjust

### Included Modules

- DataMapper::Adapters::DataObjectsAdapterAdjust::SQL

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::Adapters
- DataMapper::Adapters::DataObjectsAdapterAdjust
- DataMapper::Adapters::DataObjectsAdapterAdjust::SQL
- DataMapper::Adapters::InMemoryAdapterAdjust
- DataMapper::Adapters::YamlAdapterAdjust
- DataMapper::Collection
- DataMapper::Model
- DataMapper::Repository
- DataMapper::Resource

No matching classes.

# DataMapper::Adapters::DataObjectsAdapterAdjust

### Public Instance Methods

adjust(attributes, collection) click to toggle source

    # File lib/dm-adjust/adapters/data_objects_adapter.rb, line 4
    def adjust(attributes, collection)
      query = collection.query

      # TODO: if the query contains any links, a limit or an offset
      # use a subselect to get the rows to be updated

      properties  = []
      bind_values = []

      # make the order of the properties consistent
      query.model.properties(name).each do |property|
        next unless attributes.key?(property)
        properties  << property
        bind_values << attributes[property]
      end

      statement, conditions_bind_values = adjust_statement(properties, query)

      bind_values.concat(conditions_bind_values)

      execute(statement, *bind_values).affected_rows
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.