# Posgresql JSONB columns should NOT be declared as serialized, Rails 5
# already know how to properly treat them.
attribute :properties, :jsonbHash, default: {}
# Posgresql JSONB columns should NOT be declared as serialized, Rails 5
# already know how to properly treat them.
attribute :properties, :jsonbHash, default: {}
attribute :storage_classes_confirmed, :jsonbArray, default: []
before_validation :default_empty_manifest
attribute :storage_classes_confirmed, :jsonbArray, default: []
before_validation :default_empty_manifest
validate :protected_managed_properties_updates, on: :update
after_validation :set_file_count_and_total_size
before_save :set_file_names
validate :protected_managed_properties_updates, on: :update
after_validation :set_file_count_and_total_size
before_save :set_file_names
around_update :manage_versioning, unless: :is_past_version?
api_accessible :user, extend: :common do |t|
around_update :manage_versioning, unless: :is_past_version?
api_accessible :user, extend: :common do |t|
- if not self.replication_confirmed.nil?
+ # manifest_text_was could be nil when dealing with a freshly created snapshot,
+ # so we skip this case because there was no real manifest change. (Bug #18005)
+ if (not self.replication_confirmed.nil?) and (not self.manifest_text_was.nil?)
next # Ignore false assignment, once true it'll be true until next version
end
self.attributes = {attr => changes[attr].last}
next # Ignore false assignment, once true it'll be true until next version
end
self.attributes = {attr => changes[attr].last}
- def preserve_version_exclusive_updates_leave_modified_at_alone
- self.modified_at = self.modified_at_was
+ def maybe_update_modified_by_fields
+ if !(self.changes.keys - ['updated_at', 'preserve_version']).empty?
+ super
+ end
# validation on empty desired storage classes return an error.
def default_storage_classes
if self.storage_classes_desired.nil? || self.storage_classes_desired.empty?
# validation on empty desired storage classes return an error.
def default_storage_classes
if self.storage_classes_desired.nil? || self.storage_classes_desired.empty?