diff --git a/CHANGELOG.md b/CHANGELOG.md index f285b4c1..d9ffc910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Fixed compatibility with [ActsAsTaggableOn](https://github.com/mbleigh/acts-as-taggable-on). - [#235](https://github.com/airblade/paper_trail/pull/235) - Dropped unnecessary secondary sort on `versions` association. - [#212](https://github.com/airblade/paper_trail/pull/212) - Added `PaperTrail::Cleaner` module, useful for discarding draft versions. + - [#207](https://github.com/airblade/paper_trail/issues/207) - Versions for `'create'` events are now created with `create!` instead of + `create` so that an exception gets raised if it is appropriate to do so. - [#199](https://github.com/airblade/paper_trail/pull/199) - Rails 4 compatibility. - [#165](https://github.com/airblade/paper_trail/pull/165) - Namespaced the version class under the `PaperTrail` module. diff --git a/lib/paper_trail/has_paper_trail.rb b/lib/paper_trail/has_paper_trail.rb index 5653ab1d..7c8b1f64 100644 --- a/lib/paper_trail/has_paper_trail.rb +++ b/lib/paper_trail/has_paper_trail.rb @@ -201,8 +201,7 @@ module PaperTrail if changed_notably? and version_class.column_names.include?('object_changes') data[:object_changes] = PaperTrail.serializer.dump(changes_for_paper_trail) end - - send(self.class.versions_association_name).create merge_metadata(data) + send(self.class.versions_association_name).create! merge_metadata(data) end end