Skip to content

Releases: huacnlee/rails-settings-cached

v2.9.5

07 Oct 07:59
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.9.4...v2.9.5

v2.9.4

16 Oct 09:42
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.9.3...v2.9.4

v2.9.3

03 Oct 02:39
Compare
Choose a tag to compare

What's Changed

  • Fix generator for support Rails 7.1 by @javierav in #240
  • Add CI test for Rails 7.1

New Contributors

Full Changelog: v2.9.2...v2.9.3

v2.9.2

02 Jun 08:03
Compare
Choose a tag to compare
  • Fix #237 to allows setting to use nil value.

v2.9.1

01 Jun 01:57
Compare
Choose a tag to compare
  • Fix #236 fallback to string type when used unsupported field type.

v2.9.0

29 May 06:12
Compare
Choose a tag to compare

What's Changed

Custom type for setting

You can write your custom field type by under RailsSettings::Fields module.

For example

module RailsSettings
  module Fields
    class YesNo < ::RailsSettings::Fields::Base
      def serialize(value)
        case value
        when true then "YES"
        when false then "NO"
        else raise StandardError, 'invalid value'
        end
      end

      def deserialize(value)
        case value
        when "YES" then true
        when "NO" then false
        else nil
        end
      end
    end
  end
end

Now you can use yes_no type in you setting:

class Setting
  field :custom_item, type: :yes_no, default: 'YES'
end
irb> Setting.custom_item = 'YES'
irb> Setting.custom_item
true
irb> Setting.custom_item = 'NO'
irb> Setting.custom_item
false

New Contributors

Full Changelog: v2.8.3...v2.9.0

v2.8.3

19 Dec 15:32
Compare
Choose a tag to compare

What's Changed

  • Fix typo on class Error by @berkos in #227
  • Depend only on activerecord and railties instead of all rails by @codez in #228

New Contributors

Full Changelog: v2.8.2...v2.8.3

v2.8.2

11 Jan 08:25
Compare
Choose a tag to compare
  • Add supports for Ruby 3.1, Rails 7.0;

v2.8.1

24 Sep 08:53
Compare
Choose a tag to compare
  • Fix for Rails 5, RequestStore cache not assign issue.

v2.8.0

14 Sep 15:13
bd2c7ae
Compare
Choose a tag to compare
  • Add Middleware for only enable RequestCache in Rails request context. #219, #182