All notable changes to this project (at least, from v0.5.0 onwards) will be documented in this file.
- Ensuring consistent behaviour for tag_names array - names are not duplicated, and are normalised prior to saving (as discussed in issue #66).
Pleease note this release ends official support of Rails 3.2 and Ruby (MRI) 2.2. The code currently still works on Ruby 2.2, and all features except for the new Gutentag::Tag.names_for_scope
method work in Rails 3.2, but they're no longer tested against, and cannot be guaranteed to work in future releases.
- Added the
Gutentag::Tag.names_for_scope(scope)
method, which accepts an ActiveRecord model or a relation, and returns all tag names associated to that model/relation.
- Removing support for MRI 2.2 and Rails 3.2.
- Tests are now run against Rails 6.0, MRI 2.6, JRuby 9.2.5.
- The README documents a simpler migration (seelensonne in #55).
- Do not record changes when tag_names did not change (Stephen Oberther in #60).
- Tag validation is now added only when the tag model is loaded, rather than when the app boots. This especially simplifies setup for non-Rails apps (Michael Grosser in #54).
- A warning is displayed if the tag model is referenced without a database being present.
- Models are now lazily autoloaded for non-Rails apps (when
Rails::Engine
isn't present).
- The
tagged_with
method now finds tagged objects belonging to STI models (as discussed in #53).
- Load tag validation code only when needed, rather than being reliant on database gems being loaded first.
- Filter out blank tag names when provided via
tag_names=
(as discussed in #51).
- Tag validations logic fails gracefully when the database server cannot be reached.
- Fix
tag_names
to return persisted values on a fresh load of a tagged object (which involved distinguishing Rails 4.2 behaviour from more recent approaches).
- Dirty state support for
tag_names
is now available for Rails 4.2 onwards, and is more reliable for Rails 3.2-4.1 (supporting all known methods, such astag_names_changed?
,previous_changes
, etc.)
- Switch normalising of tag names from a callback within
Gutentag::Tag
to#name=
(Tomasz Ras in #47).
Gutentag::RemoveUnused
is now present, and can be invoked with thecall
method. It will remove all unused tags (i.e. tags that aren't connected to any taggable objects). Related to #19.
- Tag validations logic fails gracefully when no database exists (Nishutosh Sharma in #46).
This is a breaking change if you're using Gutentag without Rails: To ensure database-reliant code isn't invoked before it should be, ActiveSupport.run_load_hooks :gutentag
should be called after your database is connected.
No breaking changes.
Thanks to Robin, Gutentag::Tag#name will now validate default database column lengths (#41).
Behaviour that was deprecated in 0.9.0 (has_many_tags
, tagged_with
arguments) have now been removed.
- In your models with tags, change
has_many_tags
toGutentag::ActiveRecord.call self
. - Any calls to
tagged_with
should change fromModel.tagged_with('ruby', 'pancakes')
toModel.tagged_with(:names => ['ruby', 'pancakes'])
.
In both of the above cases, the old behaviour will continue to work for 0.9.x releases, but with a deprecation warning.
No breaking changes.
No breaking changes.
Rails 4.2 is supported as of Gutentag 0.6.0 - but please note that due to internal changes in ActiveRecord, changes to tag_names will no longer be tracked by your model's dirty state. This feature will continue to work in Rails 3.2 through to 4.1 though.
Between 0.4.0 and 0.5.0, Gutentag switched table names from tags
and taggings
to gutentag_tags
and gutentag_taggings
. This has been done to avoid conflicting with the more generic table names that may exist in Rails apps already.
If you were using Gutentag 0.4.0 (or older) and now want to upgrade, you'll need to create a migration manually that renames these tables:
rename_table :tags, :gutentag_tags
rename_table :taggings, :gutentag_taggings