Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with serialized_attributes gem #190

Merged
merged 1 commit into from
Jan 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/paper_trail/has_paper_trail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def paper_trail_on
end

# Used for Version#object attribute
def serialize_attributes(attributes)
def serialize_attributes_for_paper_trail(attributes)
serialized_attributes.each do |key, coder|
if attributes.key?(key)
attributes[key] = coder.dump(attributes[key])
end
end
end

def unserialize_attributes(attributes)
def unserialize_attributes_for_paper_trail(attributes)
serialized_attributes.each do |key, coder|
if attributes.key?(key)
attributes[key] = coder.load(attributes[key])
Expand Down Expand Up @@ -264,7 +264,7 @@ def item_before_change

def object_to_string(object)
_attrs = object.attributes.except(*self.class.paper_trail_options[:skip]).tap do |attributes|
self.class.serialize_attributes attributes
self.class.serialize_attributes_for_paper_trail attributes
end
PaperTrail.serializer.dump(_attrs)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def reify(options = {})
model = klass.new
end

model.class.unserialize_attributes attrs
model.class.unserialize_attributes_for_paper_trail attrs
attrs.each do |k, v|
if model.respond_to?("#{k}=")
model.send :write_attribute, k.to_sym, v
Expand Down