Skip to content

Commit

Permalink
Support Rails 7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alpaca-tc committed Aug 13, 2024
1 parent 9f79299 commit a6009bb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.1', '3.2']
ruby-version: ['3.1', '3.2', '3.3']

steps:
- uses: actions/checkout@v4
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: ['6.1_stable', '7.0_stable', '7.1_stable']
gemfile: ['6.1_stable', '7.0_stable', '7.1_stable', '7.2_stable']
ruby-version: ['3.1', '3.2', '3.3']
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ appraise '7.1-stable' do
gem 'activerecord', '~> 7.1.0'
gem 'sqlite3', '~> 1.7.0'
end

appraise '7.2-stable' do
gem 'activerecord', '~> 7.2.0'
end
13 changes: 13 additions & 0 deletions gemfiles/7.2_stable.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "pry"
gem "rubocop", "1.28.2"
gem "appraisal"
gem "rake"
gem "rspec"
gem "sqlite3"
gem "activerecord", "~> 7.2.0"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/active_record_bitmask/attribute_methods/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def attribute_bitmask?(attribute_name, *values)
# assert bitmask values
map = self.class.bitmask_for(attribute_name)
expected_value = map.attributes_to_bitmask(values)
current_value = map.attributes_to_bitmask(attribute(attribute_name))
current_value = map.attributes_to_bitmask(read_attribute(attribute_name))

(current_value & expected_value) == expected_value
else
Expand Down
7 changes: 6 additions & 1 deletion lib/active_record_bitmask/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ def bitmask_for(attribute)
private

def define_bitmask_attribute(attribute, map)
if ActiveRecord.gem_version >= Gem::Version.new('7.0.0')
if ActiveRecord.gem_version >= Gem::Version.new('7.2.0')
# Greater than or equal to 7.0.0
decorate_attributes([attribute]) do |name, subtype|
ActiveRecordBitmask::BitmaskType.new(name, map, subtype)
end
elsif ActiveRecord.gem_version >= Gem::Version.new('7.0.0')
# Greater than or equal to 7.0.0
attribute(attribute) do |subtype|
ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
Expand Down

0 comments on commit a6009bb

Please sign in to comment.