Skip to content

Commit

Permalink
[paper-trail-gem#43] Save object for create event
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Dec 14, 2015
1 parent 4e7a707 commit 9347672
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/paper_trail/has_paper_trail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def record_create
if paper_trail_switched_on?
data = {
:event => paper_trail_event || 'create',
:object => pt_recordable_object,
:whodunnit => PaperTrail.whodunnit
}
if respond_to?(:updated_at)
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/version_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def object_changes_col_is_json?
# - `:preserve` - Attributes undefined in version record are not modified.
#
def reify(options = {})
return nil if object.nil?
return nil if event == 'create'
without_identity_map do
::PaperTrail::Reifier.reify(self, options)
end
Expand Down
1 change: 0 additions & 1 deletion test/unit/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
end

should 'be nil in its previous version' do
assert_nil @widget.versions.first.object
assert_nil @widget.versions.first.reify
end

Expand Down

0 comments on commit 9347672

Please sign in to comment.