New major version as the change to the touch
behavior might break existing apps
and therefore is not backwards compatible.
- For AR >= 5.1, records are no longer
touch
ed after saving if- [#19] the lifecycle was halted using
throw(:abort)
(props to @Haniyya) - [#20] neither attributes nor settings were changed (basically
Model.first.save
)
- [#19] the lifecycle was halted using
This is a major bugfix release as the gem was basically broken when being installed in a fresh Rails 5 application.
- The
config/settings.yml
file is no longer generated or referenced in the code
- The tests now actually use the files generated by the install generator. This should ensure that both the migration and the model are always tested for compatibility with all supported Rails versions (#17)
- Adjusted the Gemspec to allow installation on Rails > 5.0 (#17)
- Fixed generated migration to include version information for Rails >= 5 (#17)
- Calls to
#as_json
as well as probably other parts of the AR API would fail if the gem was only included but not used (#17)
A bugfix and slight refactoring release which takes care of several issues regarding changing setting-values in-place without actually setting them before. (#13)
- More and better specs
- Better handling of non-existent settings through exception handling rather than multiple error prone tests
This is almost a complete refactoring of the gem which also removes some not really needed functionality.
It is the first release fully compatible with Rails 5.
New minimum versions:
- Ruby: 2.3
- Rails: 4.2
- Removed globally defined settings (
config/settings.yml
) and therefore also global validations and type conversions.
It is still possible to create global Settings, but each developer has to make sure that the assigned value is valid and correctly typed. - Type conversion follows AR's type conversions more strictly now.
This means that e.g. assigning1.0
to a boolean setting will result intrue
instead ofnil
as before. - Updating an attribute created through
setting_accessor
now leads to the record being touched,
similar to what would happen when a normal database attribute was changed. (#4) - Setting a new value for an attribute created through
attribute_accessor
will now mark the record as "dirty", meaningchanged?
returns true. (#9)
This was especially needed for Rails 5 as it only even performs a database operation in this case.
- Tests are now written in RSpec
- The dummy Rails application has been removed and replaced with
with_model
- Appraisal was added to test against multiple Rails versions
method_missing
is now part of the SettingScaffold and therefore no longer needed in the actual Setting model.
You should removemethod_missing
from your model.- Setting.create_or_update was renamed to Setting.set and now uses a keyword argument for
assignable
setting_accessor
no longer supports thefallback
option.
If adefault
option is given, it is automatically used as fallback.
- Fixed a bug that caused setting accessors not being initialized when being called as part of a rake task chain (#6)