diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 9c8fe65..2cad333 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,12 +9,18 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.7', '3.0', '3.1', '3.2'] - rails: ['6.1', '7.0', 'edge'] + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + rails: ['6.1', '7.0', '7.1', 'edge'] timezone_aware: [0, 1] exclude: - ruby: '3.2' rails: '6.1' + - ruby: '3.3' + rails: '6.1' + - ruby: '2.7' + rails: 'edge' + - ruby: '3.0' + rails: 'edge' env: BUNDLE_GEMFILE: gemfiles/Gemfile.ar-${{ matrix.rails }} TIMEZONE_AWARE: ${{ matrix.timezone_aware }} diff --git a/gemfiles/Gemfile.ar-7.1 b/gemfiles/Gemfile.ar-7.1 new file mode 100644 index 0000000..0188f7b --- /dev/null +++ b/gemfiles/Gemfile.ar-7.1 @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec path: '..' + +gem 'activerecord', '~> 7.0.0' diff --git a/lib/active_record/typed_store/extension.rb b/lib/active_record/typed_store/extension.rb index b50d957..1e69d74 100644 --- a/lib/active_record/typed_store/extension.rb +++ b/lib/active_record/typed_store/extension.rb @@ -22,7 +22,12 @@ def typed_store(store_attribute, options={}, &block) typed_klass = TypedHash.create(dsl.fields.values) const_set("#{store_attribute}_hash".camelize, typed_klass) - if ActiveRecord.version >= Gem::Version.new('6.1.0.alpha') + if ActiveRecord.version >= Gem::Version.new('7.2.0.alpha') + decorate_attributes([store_attribute]) do |name, subtype| + subtype = subtype.subtype if subtype.is_a?(Type) + Type.new(typed_klass, dsl.coder, subtype) + end + elsif ActiveRecord.version >= Gem::Version.new('6.1.0.alpha') attribute(store_attribute) do |subtype| subtype = subtype.subtype if subtype.is_a?(Type) Type.new(typed_klass, dsl.coder, subtype) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4960e82..8eb4eae 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,9 +9,9 @@ Time.zone = 'UTC' if ActiveRecord.respond_to?(:yaml_column_permitted_classes) - ActiveRecord.yaml_column_permitted_classes |= ['Date', 'Time', 'BigDecimal'] + ActiveRecord.yaml_column_permitted_classes |= [Date, Time, BigDecimal] elsif ActiveRecord::Base.respond_to?(:yaml_column_permitted_classes) - ActiveRecord::Base.yaml_column_permitted_classes |= ['Date', 'Time', 'BigDecimal'] + ActiveRecord::Base.yaml_column_permitted_classes |= [Date, Time, BigDecimal] end RSpec.configure do |config|