Breaking changes:
- execute_after_commit was removed
- Removed workaround for incorrect counts when triggering updates from an
after_create
hook. Your options if this applies to you:- continue using counter_culture 1.12.0
- upgrade to Rails 5.1.5 which fixes the underlying issue in Rails
- avoid triggering further updates on the same model in
after_create
; simply set the attribute inbefore_create
instead
Bugfixes:
- Multiple updates in one transaction will now be processed correctly (#222)
Improvements:
- Adds support for the Discard soft-delete gem (#220)
Bugfixes:
- Fix
with_papertrail
behavior while still addressing the deprecation warning, and actually recording the correct counts (#218, see airblade/paper_trail#1076)
Improvements:
- Added the ability to update timestamps while fixing count by passing
touch: true
tocounter_culture_fix_counts
(#212)
Bugfixes:
- When using paranoia, call increment / decrement only once when calling destroy or restore on the same model multiple times
Improvements:
- Address deprecation warning when enabling paper_trail touch in paper_trail version 9.0
- Address
Arel
deprecation warnings in Rails 5.2
Changes:
- Test against Ruby 2.2 through 2.5, Rails 3.2 through 5.2
- Don't test Rails 3.2 through 4.1 against Ruby 2.4 or 2.5 as those versions of Rails will not work with those versions of Ruby
- Avoid various deprecation warnings being triggered in the test
Bugfixes:
- Address an edge-case test regression caused by Rails 5.1.5 that was causing counts to be off when saving changes from an
after_create
callback
Improvements:
- Switch generated migration files to use new hash syntax
- Support for Rails 5 migration file format for generated migrations
Bugfixes:
- Actually use
batch_size
parameter incounter_culture_fix_counts
(#200)
Improvements:
- Use ActiveRecord version, not Rails version, in
Reconciler
, makeing it possible to usecounter_culture_fix_counts
without Rails
Improvements:
- Quote all table names to work correctly with PostgreSQL schemata
- Use ActiveRecord version, not Rails version, to make things work for projects that use ActiveRecord but not Rails
Improvements:
- Support for creating
paper_trail
versions when counters change
Bugfixes:
- Restore compatibility with older Rails versions
Bugfixes:
- Fix
counter_culture_fix_counts
for a multi-level relation where an intermediate link ishas_one
, rather thanbelongs_to
Improvements:
- Keeps counts updated correctly when using the paranoia gem and restoring soft-deleted records
Bugfixes:
- Support for
nil
values in polymorphic relationships
New features:
- Support for counter caches on one-level polymorphic relationships
Improvements:
- Avoid Rails 5.1 deprecation warnings
Bugfixes:
- Removed requirement for Rails 5 added by mistake (in fact, this gem supports and tests Rails versions as far back as Rails 3.2 now)
Removed features:
- Removed support for
has_one
; this did not work properly. If you need this, consider adding thecounter_culture
call on the model with thebelongs_to
instead.
New features:
- Add support for custom timestamp column with
touch
option
Bugfixes:
- Don't blow up if the
column_names
hash contains anil
column name
Improvements:
- Support for
has_one
associations
Breaking changes:
- By default, counter_culture will now update counts inside the same transaction that triggered it. In older versions, counter cache updates happened outside of that transaction. To preserve the old behavior, use the new
execute_after_commit
option.
Improvements:
- When running
fix_counts
on a table, wrap each batch in a transaction because that is faster on large tables.
Bugfixes:
- Use
ActiveSupport.on_load
for better Rails 5 compatibility (see rails/rails#23589)
Improvements:
Improvments:
- Major refactor of the code that reduces ActiveRecord method pollution. Documented API is unchanged, but behind the scenes a lot has changed.
- Ability to configure batch size of
counter_culture_fix_size
Bugfixes:
- Fixes an issue when using a default scope that adds a join in conjunction with counter_culture
Bugfixes:
- Fixes an issue with STI classes and inheritance
Improvements:
- Restores compatibility with Rails 3.2 (fixes #100)
Bugfixes:
- Avoid issue with has_and_belongs_to_many and transactions by using new after_commit_action version (fixes #88)
Bugfixes:
- Correctly use custom relation primary keys (fixes #93)
Bugfixes:
- Fix fixing counts with multi-level STI models
Bugfixes:
- fixes development and test dependencies
Bugfixes:
- re-add after_commit_action as a dependency, that had gone missing in 0.1.26
Bugfixes:
- makes fix_counts work correctly with self-referential tables
Bugfixes:
- makes fix_counts work correctly with custom primary keys
Bugfixes:
- correctly uses custom primary keys when incrementing / decrementing counts
Bugfixes:
- fixes problems fixing conditional counter caches with batching
Improvements:
- support for single-table inheritance in counter_culture_fix_counts
Bugfixes:
- makes the migration generator compatible with Rails 4.1
Bugfixes:
- counter_culture_fix counts now supports float values, where it forced integer values previously
Bugfixes:
- Use correct date / time formatting for touch option (fixes a problem with MySQL databases)
Bugfixes:
- Correctly fix counter caches, even when there are no dependent records
Bugfixes:
- Avoid Rails 4 deprecation warning
Features:
- Added support for touch option that updates timestamps when updating counter caches
Features:
- Added a simple migration generator to simplify adding counter cache columns
Improvements:
- delta_column now supports float values
Bugfixes:
- Prevent running out of memory when running counter_culture_fix_counts in large tables