Class: MassiveRecord::ORM::Persistence::Operations::Reload

Inherits:
Object
  • Object
show all
Includes:
MassiveRecord::ORM::Persistence::Operations, TableOperationHelpers
Defined in:
lib/massive_record/orm/persistence/operations/reload.rb

Instance Attribute Summary

Attributes included from MassiveRecord::ORM::Persistence::Operations

#klass, #options, #record

Instance Method Summary collapse

Methods included from MassiveRecord::ORM::Persistence::Operations

atomic_operation, destroy, force, #initialize, insert, reload, suppress, suppressed?, update

Methods included from TableOperationHelpers

#attributes_to_row_values_hash, calculate_missing_family_names, #calculate_missing_family_names, #ensure_that_we_have_table_and_column_families!, hbase_create_table!, #hbase_create_table!, included, #row_for_record, #store_record_to_database

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/massive_record/orm/persistence/operations/reload.rb', line 10

def execute
  if record.persisted?
    klass.find(record.id).tap do |reloaded_record|
      record.reinit_with({
        'attributes' => reloaded_record.attributes,
        'raw_data' => reloaded_record.raw_data
      })
    end

    true
  end
end