Skip to content

Commit

Permalink
Add support for ActiveRecord 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowens committed Aug 23, 2024
1 parent fca8b82 commit afa728a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ jobs:
ruby:
- 3.3
env:
- AR_VERSION: '7.2'
RUBYOPT: --enable-frozen-string-literal
- AR_VERSION: '7.1'
RUBYOPT: --enable-frozen-string-literal
- AR_VERSION: '7.0'
RUBYOPT: --enable-frozen-string-literal
- AR_VERSION: 6.1
RUBYOPT: --enable-frozen-string-literal
include:
- ruby: 3.2
env:
AR_VERSION: '7.2'
- ruby: 3.2
env:
AR_VERSION: '7.1'
Expand Down Expand Up @@ -85,15 +90,6 @@ jobs:
- ruby: 2.6
env:
AR_VERSION: 5.2
- ruby: 2.6
env:
AR_VERSION: 5.1
- ruby: 2.4
env:
AR_VERSION: '5.0'
- ruby: 2.4
env:
AR_VERSION: 4.2
runs-on: ubuntu-latest
env:
AR_VERSION: ${{ matrix.env.AR_VERSION }}
Expand Down
3 changes: 3 additions & 0 deletions gemfiles/7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

gem 'activerecord', '~> 7.2.0'
2 changes: 1 addition & 1 deletion test/models/topic.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Topic < ActiveRecord::Base
if ENV['AR_VERSION'].to_i >= 6.0
if ENV['AR_VERSION'].to_f >= 6.0
self.ignored_columns = [:priority]
end
alias_attribute :name, :title
Expand Down
13 changes: 10 additions & 3 deletions test/models/widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ class Widget < ActiveRecord::Base

default_scope -> { where(active: true) }

serialize :data, Hash
serialize :json_data, JSON
if ENV['AR_VERSION'].to_f >= 7.1
serialize :data, coder: YAML
serialize :json_data, coder: JSON
serialize :custom_data, coder: CustomCoder.new
else
serialize :data, Hash
serialize :json_data, JSON
serialize :custom_data, CustomCoder.new
end

serialize :unspecified_data
serialize :custom_data, CustomCoder.new
end

0 comments on commit afa728a

Please sign in to comment.