update

update(id, attributes) Instance Public methods Updates an object (or multiple objects) and saves it to the database, if validations pass. The resulting object is returned whether the object was saved successfully to the database or not. Parameters id - This should be the id or an array of ids to be updated. attributes - This should be a hash of attributes or an array of hashes. Examples # Updates one record Person.update(15, user_name: 'Samuel', group: 'expert') # Updates mu

update_all

update_all(updates) Instance Public methods Updates all records with details given if they match a set of conditions supplied, limits and order can also be supplied. This method constructs a single SQL UPDATE statement and sends it straight to the database. It does not instantiate the involved models and it does not trigger Active Record callbacks or validations. Parameters updates - A string, array, or hash representing the SET part of an SQL statement. Examples # Update all cu

values

values() Instance Public methods

where_values_hash

where_values_hash(relation_table_name = table_name) Instance Public methods Returns a hash of where conditions. User.where(name: 'Oscar').where_values_hash # => {name: "Oscar"}

new

new(columns, rows, column_types = {}) Class Public methods

[]

[](idx) Instance Public methods

column_type

column_type(name) Instance Public methods

each

each() Instance Public methods

empty?

empty?() Instance Public methods Returns true if there are no records.

initialize_copy

initialize_copy(other) Instance Public methods