Module: Torque::PostgreSQL::Inheritance::Record

Defined in:
lib/torque/postgresql/inheritance/record.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

Deleting a row only needs its primary key, so the missing columns of a partial record are no reason to refuse it



24
25
26
27
28
# File 'lib/torque/postgresql/inheritance/record.rb', line 24

def destroy
  return super unless partial_record?

  without_readonly { super }
end

#partial_record?Boolean

Whether the record was loaded from one of its ancestor tables and therefore is missing the columns that only exist on its own table

Returns:

  • (Boolean)


10
11
12
# File 'lib/torque/postgresql/inheritance/record.rb', line 10

def partial_record?
  @partial_record == true
end

#reloadObject

Reload always queries the record's own table, which produces a complete and writable record



16
17
18
19
20
# File 'lib/torque/postgresql/inheritance/record.rb', line 16

def reload(*)
  return super unless partial_record?

  super.tap { mark_as_full_record! }
end