paper_trail 4.0.0
4.0.0 (2015-07-30)
This major release adds JSON column support in PostgreSQL, limited support for versioning associations, various new configuration options, and a year's worth of bug fixes. Thanks to everyone who helped test the two betas and two release candidates.
Breaking Changes
- Using a Rails initializer to reopen PaperTrail::Version or otherwise extend PaperTrail is no longer recommended. An alternative is described in the readme. See https://github.com/paper-trail-gem/paper_trail/pull/557 and https://github.com/paper-trail-gem/paper_trail/pull/492.
- If you depend on the
RSpecorCucumberhelpers, you must require them in your test helper. - #566 - Removed deprecated
methods
paper_trail_onandpaper_trail_off. Usepaper_trail_on!andpaper_trail_off!instead. - #458 - Version metadata
(the
:metaoption) from AR attributes forcreateevents will now save the current value instead ofnil. - #391 -
object_changesvalue should dump toYAMLas a normalHashinstead of anActiveSupport::HashWithIndifferentAccess. - #375 /
#374 /
#354 /
#131 -
Versions are now saved with an
after_callback, instead of abefore_callback. This ensures that the timestamp field for a version matches the corresponding timestamp in the model. 3da1f104-PaperTrail.configandPaperTrail.configureare now identical: both return thePaperTrail::Configinstance and also yield it if a block is provided.
Added
- #525 / #512 - Support for virtual accessors and redefined setter and getter methods.
- #518 - Support for
querying against PostgreSQL's
JSONandJSONBcolumn types viaPaperTrail::VersionConcern#where_objectandPaperTrail::VersionConcern#where_object_changes - #507 -
New option:
:save_changescontrols whether or not to save changes to theobject_changescolumn (if it exists). - #500 - Support for
passing an empty array to the
onoption (on: []) to disable all automatic versioning. - #494 - The install generator will warn the user if the migration they are attempting to generate already exists.
- #484 - Support for
PostgreSQL's
JSONBType for storingobjectandobject_changes. - #439 / #12 - Support for versioning associations (has many, has one, etc.) one level deep.
- #420 - Add
VersionConcern#where_object_changesinstance method; acts as a helper for querying against theobject_changescolumn in versions table. - #416 - Added a
configoption for enabling/disabling utilization ofserialized_attributesforActiveRecord, necessary becauseserialized_attributeshas been deprecated inActiveRecordversion4.2and will be removed in version5.0 - #399 - Add
:dupargument for options hash toreifywhich forces a new model instance. - #394 - Add RSpec matcher
have_a_version_withfor easier testing. - #347 - Autoload
ActiveRecordmodels in via aRails::Enginewhen the gem is used withRails.
Fixed
- #563 - Fixed a bug in
touch_with_versionso that it will still create a version even when theonoption is, e.g.[:create]. - #541 -
PaperTrail.config.enabledshould be Thread Safe - #451 - Fix
reifymethod in context of model where the base class has a default scope, and the live instance is not scoped within that default scope. - #440 -
versionsassociation should clear/reload after a transaction rollback. - #438 -
ModelKlass.paper_trail_enabled_for_model?should returnfalseifhas_paper_trailhas not been declared on the class. - #404 /
#428 -
model_instance.dupdoes not need to be invoked when examining what the instance looked like before changes were persisted, which avoids issues if a 3rd party has overriden thedupbehavior. Also fixes errors occuring when a user attempts to update the inheritance column on an STI model instance inActiveRecord4.1.x - #427 - Fix
reifymethod in context of model where a column has been removed. - #414 - Fix
functionality
ignoreargument tohas_paper_trailinActiveRecord4. - #413 - Utilize
RequestStore to ensure that
the
PaperTrail.whodunnitis set in a thread safe manner within Rails and Sinatra. - #381 - Fix
irbwarning:can't alias context from irb_context.RspecandCucumberhelpers should not be loaded by default, regardless of whether those libraries are loaded. - #248 - In MySQL, to
prevent truncation, generated migrations now use
longtextinstead oftext. - Methods handling serialized attributes should fallback to the currently set
Serializer instead of always falling back to
PaperTrail::Serializers::YAML.
Deprecated
- #479 - Deprecated
originatormethod, usepaper_trail_originator.