mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
39e1e56374
The next release will contain backwards incompatible changes when used with Rails, so this is important
16 KiB
16 KiB
4.0.0 (Unreleased)
Breaking change: if you use a custom initializer for PaperTrail in conjunction with Rails, you will need to add this line of code to the beginning of it:
PaperTrail::Rails::Engine.eager_load!
- #439 / #12 - Support for versioning of associations (Has Many, Has One, HABTM, etc.)
- #440 -
versions
association should clear/reload after a transaction rollback. - #438 -
Model.paper_trail_enabled_for_model?
should returnfalse
ifhas_paper_trail
has not been declared on the class. - #427 - Fix
reify
method in context of model where a column has been removed. - #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
- #414 - Fix functionality
ignore
argument tohas_paper_trail
inActiveRecord
4. - #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. - #391 -
object_changes
value should dump toYAML
as a normalHash
instead of anActiveSupport::HashWithIndifferentAccess
. - #375 / #374 /
#354 / #131 -
Versions should be built with
after_
callbacks so the timestamp field for a version can be forced to match the corresponding timestamp in the database for the state persistence of a change to the base (versioned) model. - #347 - Autoload
ActiveRecord
models in via aRails::Engine
when the gem is used withRails
. - Methods handling serialized attributes should fallback to the currently set Serializer instead of always falling back
to
PaperTrail::Serializers::YAML
.
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 with in 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 versiontouch
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.