Class: MigrationRecord
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- MigrationRecord
- Defined in:
- app/models/migration_record.rb
Instance Method Summary collapse
-
#display_name ⇒ Object
Instance methods.
-
#record_changes ⇒ Object
Custom getter for record_changes.
-
#record_changes=(value) ⇒ Object
Custom setter for record_changes.
- #success? ⇒ Boolean
Instance Method Details
#display_name ⇒ Object
Instance methods
47 48 49 |
# File 'app/models/migration_record.rb', line 47 def display_name "#{migrated_model_name} #{record_identifier}" end |
#record_changes ⇒ Object
Custom getter for record_changes
24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/migration_record.rb', line 24 def record_changes value = read_attribute(:record_changes) return {} if value.blank? return value if value.is_a?(Hash) JSON.parse(value) rescue JSON::ParserError => e Rails.logger.error "Failed to parse record_changes for MigrationRecord #{id}: #{e.}" {} end |
#record_changes=(value) ⇒ Object
Custom setter for record_changes
36 37 38 39 40 41 42 43 44 |
# File 'app/models/migration_record.rb', line 36 def record_changes=(value) if value.is_a?(String) write_attribute(:record_changes, value) elsif value.is_a?(Hash) write_attribute(:record_changes, value.to_json) else write_attribute(:record_changes, {}.to_json) end end |
#success? ⇒ Boolean
51 52 53 |
# File 'app/models/migration_record.rb', line 51 def success? !failed? end |