Alphabetize methods
This commit is contained in:
parent
baa9b1a9cd
commit
85884ba06c
|
@ -111,28 +111,6 @@ module PaperTrail
|
||||||
changes_in_latest_version.keys
|
changes_in_latest_version.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
# @api private
|
|
||||||
def prepare_object_changes(changes)
|
|
||||||
changes = serialize_object_changes(changes)
|
|
||||||
changes = recordable_object_changes(changes)
|
|
||||||
changes
|
|
||||||
end
|
|
||||||
|
|
||||||
# @api private
|
|
||||||
def serialize_object_changes(changes)
|
|
||||||
AttributeSerializers::ObjectChangesAttribute.
|
|
||||||
new(@record.class).
|
|
||||||
serialize(changes)
|
|
||||||
changes.to_hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# @api private
|
|
||||||
def notable_changes
|
|
||||||
changes_in_latest_version.delete_if { |k, _v|
|
|
||||||
!notably_changed.include?(k)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Rails 5.1 changed the API of `ActiveRecord::Dirty`. See
|
# Rails 5.1 changed the API of `ActiveRecord::Dirty`. See
|
||||||
# https://github.com/paper-trail-gem/paper_trail/pull/899
|
# https://github.com/paper-trail-gem/paper_trail/pull/899
|
||||||
#
|
#
|
||||||
|
@ -213,6 +191,13 @@ module PaperTrail
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @api private
|
||||||
|
def notable_changes
|
||||||
|
changes_in_latest_version.delete_if { |k, _v|
|
||||||
|
!notably_changed.include?(k)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# @api private
|
# @api private
|
||||||
def notably_changed
|
def notably_changed
|
||||||
only = @record.paper_trail_options[:only].dup
|
only = @record.paper_trail_options[:only].dup
|
||||||
|
@ -238,6 +223,13 @@ module PaperTrail
|
||||||
attrs
|
attrs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @api private
|
||||||
|
def prepare_object_changes(changes)
|
||||||
|
changes = serialize_object_changes(changes)
|
||||||
|
changes = recordable_object_changes(changes)
|
||||||
|
changes
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an object which can be assigned to the `object_changes`
|
# Returns an object which can be assigned to the `object_changes`
|
||||||
# attribute of a nascent version record. If the `object_changes` column is
|
# attribute of a nascent version record. If the `object_changes` column is
|
||||||
# a postgres `json` column, then a hash can be used in the assignment,
|
# a postgres `json` column, then a hash can be used in the assignment,
|
||||||
|
@ -286,6 +278,14 @@ module PaperTrail
|
||||||
PaperTrail.serializer.dump(object_attrs_for_paper_trail(is_touch))
|
PaperTrail.serializer.dump(object_attrs_for_paper_trail(is_touch))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @api private
|
||||||
|
def serialize_object_changes(changes)
|
||||||
|
AttributeSerializers::ObjectChangesAttribute.
|
||||||
|
new(@record.class).
|
||||||
|
serialize(changes)
|
||||||
|
changes.to_hash
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue