Skip to content

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 RSpec or Cucumber helpers, you must require them in your test helper.
  • #566 - Removed deprecated methods paper_trail_on and paper_trail_off. Use paper_trail_on! and paper_trail_off! instead.
  • #458 - Version metadata (the :meta option) from AR attributes for create events will now save the current value instead of nil.
  • #391 - object_changes value should dump to YAML as a normal Hash instead of an ActiveSupport::HashWithIndifferentAccess.
  • #375 / #374 / #354 / #131 - Versions are now saved with an after_ callback, instead of a before_ callback. This ensures that the timestamp field for a version matches the corresponding timestamp in the model.
  • 3da1f104 - PaperTrail.config and PaperTrail.configure are now identical: both return the PaperTrail::Config instance 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 JSON and JSONB column types via PaperTrail::VersionConcern#where_object and PaperTrail::VersionConcern#where_object_changes
  • #507 - New option: :save_changes controls whether or not to save changes to the object_changes column (if it exists).
  • #500 - Support for passing an empty array to the on option (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 JSONB Type for storing object and object_changes.
  • #439 / #12 - Support for versioning associations (has many, has one, etc.) one level deep.
  • #420 - Add VersionConcern#where_object_changes instance method; acts as a helper for querying against the object_changes column in versions table.
  • #416 - Added a config option for enabling/disabling utilization of serialized_attributes for ActiveRecord, necessary because serialized_attributes has been deprecated in ActiveRecord version 4.2 and will be removed in version 5.0
  • #399 - Add :dup argument for options hash to reify which forces a new model instance.
  • #394 - Add RSpec matcher have_a_version_with for easier testing.
  • #347 - Autoload ActiveRecord models in via a Rails::Engine when the gem is used with Rails.

Fixed

  • #563 - Fixed a bug in touch_with_version so that it will still create a version even when the on option is, e.g. [:create].
  • #541 - PaperTrail.config.enabled should be Thread Safe
  • #451 - Fix reify method in context of model where the base class has a default scope, and the live instance is not scoped within that default scope.
  • #440 - versions association should clear/reload after a transaction rollback.
  • #438 - ModelKlass.paper_trail_enabled_for_model? should return false if has_paper_trail has not been declared on the class.
  • #404 / #428 - model_instance.dup does 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 the dup behavior. Also fixes errors occuring when a user attempts to update the inheritance column on an STI model instance in ActiveRecord 4.1.x
  • #427 - Fix reify method in context of model where a column has been removed.
  • #414 - Fix functionality ignore argument to has_paper_trail in ActiveRecord 4.
  • #413 - Utilize RequestStore to ensure that the PaperTrail.whodunnit is set in a thread safe manner within Rails and Sinatra.
  • #381 - Fix irb warning: can't alias context from irb_context. Rspec and Cucumber helpers should not be loaded by default, regardless of whether those libraries are loaded.
  • #248 - In MySQL, to prevent truncation, generated migrations now use longtext instead of text.
  • Methods handling serialized attributes should fallback to the currently set Serializer instead of always falling back to PaperTrail::Serializers::YAML.

Deprecated

  • #479 - Deprecated originator method, use paper_trail_originator.