38 KiB
Changelog
This project follows semver 2.0.0 and the recommendations of keepachangelog.com.
Unreleased
Breaking Changes
- None
Added
- None
Fixed
- None
Other
- Stop testing against rails 5.0, which reached EoL on 2018-04-15, when 5.2 was released, per the rails maintenance policy
9.0.1 (2018-04-23)
Breaking Changes
- None
Added
- #1076
Add
save_with_version
, a replacement for deprecated methodtouch_with_version
. Not exactly the same, it's a save, not a touch. - #1074
PaperTrail.request do ... end
now returns the value the given block.
Fixed
- None
9.0.0 (2018-03-26)
Breaking Changes, Major
- #1063 -
touch
will now create a version. This can be configured with the:on
option. See documentation section 2.a. "Choosing Lifecycle Events To Monitor". - Drop support for ruby 2.2, whose EoL is the end of March, 2018
- PaperTrail now uses
frozen_string_literal
, so you should assume that all strings it returns are frozen. - Using
where_object_changes
to read YAML from a text column will now raise error, was deprecated in 8.1.0.
Breaking Changes, Minor
- Removed deprecated
Version#originator
, use#paper_trail_originator
- Using paper_trail.on_destroy(:after) with ActiveRecord's belongs_to_required_by_default will produce an error instead of a warning.
- Removed the
warn_about_not_setting_whodunnit
controller method. This will only be a problem for you if you are skipping it, eg.skip_after_action :warn_about_not_setting_whodunnit
, which few people did.
Deprecated
- #1063 -
paper_trail.touch_with_version
is deprecated in favor oftouch
. - #1033 - Request variables
are now set using eg.
PaperTrail.request.whodunnit=
and the old way,PaperTrail.whodunnit=
is deprecated.
Added
- #1067 - Add support to Rails 5.2.
- #1033 -
Set request variables temporarily using a block, eg.
PaperTrail.request(whodunnit: 'Jared') do .. end
- #1037 Add
paper_trail.update_columns
- #961 - Instead of crashing when misconfigured Custom Version Classes are used, an error will be raised earlier, with a much more helpful message.
- Failing to set PaperTrail.config.track_associations will no longer produce a warning. The default (false) will remain the same.
Fixed
- #1051 -
touch_with_version
should always create a version, regardles of the:only
option - #1047 - A rare issue
where
touch_with_version
saved less data than expected, but only when the update callback was not installed, eg.has_paper_trail(on: [])
- #1042 - A rare issue with load order when using PT outside of rails
- #594 - Improved the error message for a very rare issue in the experimental association tracking feature involving two has_one associations, referencing STI models with the same base class, and the same foreign_key.
8.1.2 (2017-12-22)
Breaking Changes
- None
Added
- None
Fixed
- #1028 Reifying
associations will now use
base_class
name instead of class name to reify STI models corrrectly.
8.1.1 (2017-12-10)
Breaking Changes
- None
Added
- None
Fixed
- #1018 Serializing postgres arrays
8.1.0 (2017-11-30)
Breaking Changes
- None
Added
- #997
Deprecate
where_object_changes
when reading YAML from a text column
Fixed
- #1009
End generated
config/initializers/paper_trail.rb
with newline.
8.0.1 (2017-10-25)
Breaking Changes
- None
Added
- None
Fixed
- #1003 - Warn when PT cannot be loaded because rails is not loaded yet.
8.0.0 (2017-10-04)
Breaking Changes
- Drop support for rails 4.0 and 4.1, whose EoL was 2016-06-30
- Drop support for ruby 2.1, whose EoL was 2017-04-01
- #803 - where_object_changes no longer supports reading json from a text column
Added
- None
Fixed
- #996 - Incorrect item_type in association reification query
7.1.3 (2017-09-19)
Breaking Changes
- None
Added
- None
Fixed
- #988 - Fix ActiveRecord
version check in
VersionConcern
for Rails 4.0
7.1.2 (2017-08-30)
Breaking Changes
- None
Added
- None
Fixed
- #985 - Fix RecordInvalid error on nil item association when belongs_to_required_by_default is enabled.
7.1.1 (2017-08-18)
Breaking Changes
- None
Added
- None
Fixed
- Stop including unnecessary files in released gem. Reduces .gem file size from 100K to 30K.
- #984 - Fix NameError suspected to be caused by autoload race condition.
7.1.0 (2017-07-09)
Breaking Changes
- None
Added
- #803
Deprecate
where_object_changes
when reading json from a text column - #976
PaperTrail.whodunnit
accepts aProc
Fixed
- None
7.0.3 (2017-06-01)
Breaking Changes
- None
Added
- None
Fixed
- #959 -
Add migration version (eg.
[5.1]
) to all migration generators.
7.0.2 (2017-04-26)
Breaking Changes
- None
Added
- #932 -
PaperTrail.whodunnit
now accepts a block.
Fixed
- #956 - Fix ActiveRecord >= 5.1 version check
7.0.1 (2017-04-10)
Breaking Changes
- None
Added
- Generate cleaner migrations for databases other than MySQL
Fixed
- #949 - Inherit from the
new versioned migration class, e.g.
ActiveRecord::Migration[5.1]
7.0.0 (2017-04-01)
Breaking Changes
- Drop support for ruby 1.9.3, whose EOL was 2015-02-23
- Drop support for ruby 2.0.0, whose EOL was 2016-02-24
- Remove deprecated config methods:
- PaperTrail.serialized_attributes?
- PaperTrail.config.serialized_attributes
- PaperTrail.config.serialized_attributes=
- Sinatra integration moved to paper_trail-sinatra gem
Added
PaperTrail.gem_version
returns aGem::Version
, nice for comparisons.
Fixed
- #925 - Update RSpec matchers to work with custom version association names
- #929 - Fix error calling private method in rails 4.0
- #938 - Fix bug where non-standard foreign key names broke belongs_to associations
- #940 - When destroying versions to stay under version_limit, don't rely on the database to implicitly return the versions in the right order
6.0.2 (2016-12-13)
Breaking Changes
- None
Added
- None
Fixed
88e513f
- Surprise argument modification bug inwhere_object_changes
c7efd62
- Column type-detection bug inwhere_object_changes
- #905 - Only invoke
logger.warn
iflogger
instance exists
Code Quality
- Improve Metrics/AbcSize from 30 to 22
- Improve Metrics/PerceivedComplexity from 10 to 9
6.0.1 (2016-12-04)
Breaking Changes
- None
Added
- None
Fixed
- Remove rails 3 features that are no longer supported, most notably,
protected_attributes
.
6.0.0 (2016-12-03)
Now with rails 5.1 support, and less model pollution! About 40 methods that were polluting your models' namespaces have been removed, reducing the chances of a name conflict with your methods.
Breaking Changes
- #898 - Dropped support for rails 3
- #864 - The model methods
deprecated in 5.2.0 have been removed. Use
paper_trail.x
instead ofx
. - #861 -
timestamp_field=
removed without replacement. It is no longer configurable. The timestamp field in theversions
table must now be namedcreated_at
.
Deprecated
- None
Added
- #900 - Support for rails 5.1
- #881 - Add RSpec matcher
have_a_version_with_changes
for easier testing.
Fixed
- None
5.2.3 (2016-11-29)
Breaking Changes
- None
Deprecated
- None
Added
- None
Fixed
- #889 - Fix warning message in instances when a version can't be persisted due to validation errors.
- #868 Fix usage of find_by_id when primary key is not id, affecting reifying certain records.
5.2.2 (2016-09-08)
Breaking Changes
- None
Deprecated
Added
- None
Fixed
- None
5.2.1 (2016-09-02)
Breaking Changes
- None
Deprecated
- None
Added
- None
Fixed
- #857 - Fix deserialization of enums written by PT 4.
- #798 -
Fix a rare bug with serialization of enums in rails 4.2 only when
using
touch_with_version
.
5.2.0 (2016-06-27)
Breaking Changes
- None
Deprecated
- #719 - The majority of model methods. Use paper_trail.x instead of x. Why? Your models are a crowded namespace, and we want to get out of your way!
Added
- None
Fixed
- None
5.1.1 (2016-05-31)
Breaking Changes
- None
Added
- None
Fixed
- #813 - Warning for paper_trail_on_destroy(:after) for pre-releases of AR 5
- #651 - Bug with installing PT on MySQL <= 5.6
5.1.0 (2016-05-20)
Breaking Changes
- None
Added
- #809 - Print warning if version cannot be saved.
Fixed
- #812 - Issue with saving HABTM associated objects using accepts_nested_attributes_for
- #811 - Avoid unnecessary query in #record_destroy
- Improvements to documentation
5.0.1 (2016-05-04)
Breaking Changes
- None
Added
- None
Fixed
- #791 -
A rare issue in applications that override
warn
. - #789 - A potentially common issue, in applications with initializers that use versioned models.
5.0.0 (2016-05-02)
Breaking Changes
- #758 -
PaperTrail.config.track_associations
getter method removed, usetrack_associations?
instead. - #740 -
PaperTrail.config.track_associations?
now defaults to false - #723 -
PaperTrail.enabled=
now affects all threads - #556 /
#301 -
If you are tracking who is responsible for changes with
whodunnit
, be aware that PaperTrail no longer adds theset_paper_trail_whodunnit
before_action for you. Please add this before_action to your ApplicationController to continue recording whodunnit. See the readme for an example. - #683 /
#682 -
Destroy callback default changed to :before to accommodate ActiveRecord 5
option
belongs_to_required_by_default
and new Rails 5 default.
Added
- #771 - Added support for has_and_belongs_to_many associations
- #741 / #681 MySQL unicode support in migration generator
- #689 - Rails 5 compatibility
- Added a rails config option:
config.paper_trail.enabled
- #503 - Support for reifying belongs_to associations.
Fixed
- #777 -
Support HMT associations with
:source
option. - #738 -
Rare bug where a non-versioned STI parent caused
changeset
to return an empty hash. - #731 -
Map enums to database values before storing in
object_changes
column. - #715 - Optimize post-rollback association reset.
- #701 / #699 - Cleaning old versions explicitly preserves the most recent versions instead of relying on database result ordering.
- #635 - A bug where it was not possible to disable PT when using a multi-threaded webserver.
- #584 - Fixed deprecation warning for Active Record after_callback / after_commit
4.2.0 (2016-05-31)
Breaking Changes
- None
Added
- #808 -
Warn when destroy callback is set to :after with ActiveRecord 5
option
belongs_to_required_by_default
set totrue
.
Fixed
- None
4.1.0 (2016-01-30)
Known Issues
- Version changesets now store ENUM values incorrectly (as nulls). Previously the values were stored as strings. This only affects Rails 4, not Rails 5. See #926
Breaking Changes
- None
Added
Fixed
- None
4.0.2 (2016-01-19)
Breaking Changes
- None
Added
- None
Fixed
4.0.1 (2015-12-14)
Breaking Changes
- None
Added
- None
Fixed
- #636 - Should compile assets without a db connection
- #589 / #588 - Fixes timestamp for "create" versions
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
orCucumber
helpers, you must require them in your test helper. - #566 - Removed deprecated
methods
paper_trail_on
andpaper_trail_off
. Usepaper_trail_on!
andpaper_trail_off!
instead. - #458 - Version metadata
(the
:meta
option) from AR attributes forcreate
events will now save the current value instead ofnil
. - #391 -
object_changes
value should dump toYAML
as a normalHash
instead 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.config
andPaperTrail.configure
are now identical: both return thePaperTrail::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
andJSONB
column types viaPaperTrail::VersionConcern#where_object
andPaperTrail::VersionConcern#where_object_changes
- #507 -
New option:
:save_changes
controls whether or not to save changes to theobject_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 storingobject
andobject_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 theobject_changes
column in versions table. - #416 - Added a
config
option for enabling/disabling utilization ofserialized_attributes
forActiveRecord
, necessary becauseserialized_attributes
has been deprecated inActiveRecord
version4.2
and will be removed in version5.0
- #399 - Add
:dup
argument for options hash toreify
which forces a new model instance. - #394 - Add RSpec matcher
have_a_version_with
for easier testing. - #347 - Autoload
ActiveRecord
models in via aRails::Engine
when the gem is used withRails
.
Fixed
- #563 - Fixed a bug in
touch_with_version
so that it will still create a version even when theon
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 returnfalse
ifhas_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 thedup
behavior. Also fixes errors occuring when a user attempts to update the inheritance column on an STI model instance inActiveRecord
4.1.x - #427 - Fix
reify
method in context of model where a column has been removed. - #414 - Fix
functionality
ignore
argument tohas_paper_trail
inActiveRecord
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
andCucumber
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 oftext
. - 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, usepaper_trail_originator
.
3.0.9
- #479 - Deprecated
originator
method in favor ofpaper_trail_originator
Deprecation warning informs users that theoriginator
of the methods will be removed in version4.0
. (Backported from v4) - Updated deprecation warnings for
Model.paper_trail_on
andModel.paper_trail_off
to have display correct version number the methods will be removed (4.0
)
3.0.8
3.0.7
- #404 / #428 -
Fix errors occuring when a user attempts to update the inheritance column on an STI model instance in
ActiveRecord
4.1.x
3.0.6
- #414 - Backport fix for
ignore
argument tohas_paper_trail
inActiveRecord
4.
3.0.5
- #401 / #406 -
PaperTrail::Version
class is not loaded via aRails::Engine
, even when the gem is used within Rails. This feature has will be re-introduced in version4.0
. - #398 - Only require the
RSpec
helper ifRSpec::Core
is required.
3.0.3
This version was yanked from RubyGems and has been replaced by version 3.0.5
, which is almost identical, but does not eager load
in the PaperTrail::Version
class through a Rails::Engine
when the gem is used on Rails since it was causing issues for some users.
- #386 - Fix eager loading of
versions
association with custom class name inActiveRecord
4.1. - #384 - Fix
VersionConcern#originator
instance method. - #383 - Make gem compatible with
ActiveRecord::Enum
(available inActiveRecord
4.1+). - #380 / #377 -
Add
VersionConcern#where_object
instance method; acts as a helper for querying against theobject
column in versions table. - #373 - Fix default sort order for the
versions
association inActiveRecord
4.1. - #372 - Use Arel for SQL construction.
- #365 -
VersionConcern#version_at
should returnnil
when receiving a timestamp that occured after the object was destroyed. - Expand
PaperTrail::VERSION
into a module, mimicking the form used by Rails to give it some additional modularity & versatility. - Fixed
VersionConcern#index
instance method so that it conforms to using the primary key for ordering when possible.
3.0.2
- #357 - If a
Version
instance is reified and then persisted at that state, it's timestamp attributes for update should still gettouch
ed. - #351 / #352 -
PaperTrail::Rails::Controller
should hook into all controller types, and should not get loaded unlessActionController
is. - #346 -
user_for_paper_trail
method should accommodate different types for return values fromcurrent_user
method. - #344 - Gem is now tested against
MySQL
andPostgreSQL
in addition toSQLite
. - #317 / #314 -
versions
should default to ordering via the primary key if it is an integer to avoid timestamp comparison issues. PaperTrail::Cleaner.clean_versions!
should group versions byPaperTrail.timestamp_field
when deciding which ones to keep / destroy, instead of always grouping by thecreated_at
field.- If a
Version
instance is reified and then persisted at that state, it's source version (model_instance#version_association_name
, usuallymodel_instance#version
) will get cleared since persisting it causes it to become the live instance. - If
destroy
actions are tracked for a versioned model, invokingdestroy
on the model will cause the corresponding version that gets generated to be assigned as the source version (model_instance#version_association_name
, usuallymodel_instance#version
).
3.0.1
- #340 - Prevent potential error encountered when using the
InstallGenerator
with Rails4.1.0.rc1
. - #334 - Add small-scope
whodunnit
method toPaperTrail::Model::InstanceMethods
. - #329 - Add
touch_with_version
method toPaperTrail::Model::InstanceMethods
, to allow for generating a version whiletouch
ing a model. - #328 / #326 /
#307 -
Model.paper_trail_enabled_for_model?
andmodel_instance.without_versioning
is now thread-safe. - #316 -
user_for_paper_trail
should default tocurrent_user.try(:id)
instead ofcurrent_user
(ifcurrent_user
is defined). - #313 - Make the
Rails::Controller
helper compatible withActionController::API
for compatibility with therails-api
gem. - #312 - Fix RSpec
with_versioning
class level helper method. model_instance.without_versioning
now yields themodel_instance
, enabling syntax like this:model_instance.without_versioning { |obj| obj.update_attributes(:name => 'value') }
.- Deprecated
Model.paper_trail_on
andModel.paper_trail_off
in favor of bang versions of the methods. Deprecation warning informs users that the non-bang versions of the methods will be removed in version4.0
3.0.0
- #305 -
PaperTrail::VERSION
should be loaded at runtime. - #295 - Explicitly specify table name for version class when
querying attributes. Prevents
AmbiguousColumn
errors on certainJOIN
statements. - #289 - Use
ActiveSupport::Concern
for implementation of base functionality onPaperTrail::Version
class. Increases flexibility and makes it easier to use custom version classes with multipleActiveRecord
connections. - #288 - Change all scope declarations to class methods on the
PaperTrail::Version
class. Fixes usability whenPaperTrail::Version.abstract_class? == true
. - #287 - Support for
PostgreSQL's JSON Type for storing
object
andobject_changes
. - #281 -
Rails::Controller
helper will returnfalse
for thepaper_trail_enabled_for_controller
method ifPaperTrail.enabled? == false
. - #280 - Don't track virtual timestamp attributes.
- #278 / #272 - Make RSpec and Cucumber helpers usable with Spork and Zeus.
- #273 - Make the
only
andignore
options acceptHash
arguments; allows for conditional tracking. - #264 - Allow unwrapped symbol to be passed in to the
on
option. - #224/#236 - Fixed compatibility with ActsAsTaggableOn.
- #235 - Dropped unnecessary secondary sort on
versions
association. - #216 - Added helper & extension for RSpec, and helper for Cucumber.
- #212 - Added
PaperTrail::Cleaner
module, useful for discarding draft versions. - #207 - Versions for
'create'
events are now created withcreate!
instead ofcreate
so that an exception gets raised if it is appropriate to do so. - #199 - Rails 4 compatibility.
- #165 - Namespaced the
Version
class under thePaperTrail
module. - #119 - Support for Sinatra; decoupled gem from
Rails
. - Renamed the default serializers from
PaperTrail::Serializers::Yaml
andPaperTrail::Serializers::Json
to the capitalized forms,PaperTrail::Serializers::YAML
andPaperTrail::Serializers::JSON
. - Removed deprecated
set_whodunnit
method from Rails Controller scope.
2.7.2
- #228 - Refactored default
user_for_paper_trail
method implementation so thatcurrent_user
only gets invoked if it is defined. - #219 - Fixed issue where attributes stored with
nil
value might not get reified properly depending on the way the serializer worked. - #213 - Added a
version_limit
option to thePaperTrail::Config
options that can be used to restrict the number of versions PaperTrail will store per object instance. - #187 - Confirmed JRuby support.
- #174 - The
event
field on the versions table can now be customized.
2.7.1
- #206 - Fixed Ruby 1.8.7 compatibility for tracking
object_changes
. - #200 - Fixed
next_version
method so that it returns the live model when called on latest reified version of a model prior to the live model. - #197 - PaperTrail now falls back on using YAML for serialization of
serialized model attributes for storage in the
object
andobject_changes
columns in theVersion
table. This fixes compatibility forRails 3.0.x
for projects that employ theserialize
declaration on a model. - #194 - A JSON serializer is now included in the gem.
- #192 -
object_changes
should store serialized representation of serialized attributes forcreate
actions (in addition toupdate
actions, which had already been patched by #180). - #190 - Fixed compatibility with SerializedAttributes gem.
- #189 - Provided support for a
configure
block initializer. - Added
setter
method for theserializer
config option.
2.7.0
- #183 - Fully qualify the
Version
class to help prevent namespace resolution errors within other gems / plugins. - #180 - Store serialized representation of serialized attributes
on the
object
andobject_changes
columns in theVersion
table. - #164 - Allow usage of custom serializer for storage of object attributes.
2.6.4
- #181/#182 -
Controller metadata methods should only be evaluated when
paper_trail_enabled_for_controller == true
. - #177/#178 -
Factored out
version_key
into it's own method to preventConnectionNotEstablished
error from getting thrown in instances wherehas_paper_trail
is declared on class prior to ActiveRecord establishing a connection. - #176 - Force metadata calls for attributes to use current value if attribute value is changing.
- #173 - Update link to diff-lcs.
- #172 - Save
object_changes
on creation. - #168 - Respect conditional
:if
or:unless
arguments to thehas_paper_trail
method fordestroy
events. - #167 - Fix
originator
method so that it works with subclasses and STI. - #160 - Fixed failing tests and resolved out of date dependency issues.
- #157 - Refactored
class_attribute
names on theClassMethods
module for names that are not obviously pertaining to PaperTrail to prevent method name collision.