Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.3'
- '3.4'
rails:
- '7.1'
- '7.2'
- '8.0'
- '8.1'
database_url:
- sqlite3:test_db
env:
RAILS_VERSION: ${{ matrix.rails }}
DATABASE_URL: ${{ matrix.database_url }}
name: Ruby ${{ matrix.ruby }} Rails ${{ matrix.rails }} DB ${{ matrix.database_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
gemspec

platforms :ruby do
gem 'sqlite3', '>= 1.4'
gem 'sqlite3', '>= 2.1'
end

platforms :jruby do
Expand All @@ -17,7 +17,7 @@ when 'master'
gem 'railties', { git: 'https://github.com/rails/rails.git' }
gem 'arel', { git: 'https://github.com/rails/arel.git' }
when 'default'
gem 'railties', '~> 7.1.0'
gem 'railties', '~> 8.1.0'
else
gem 'railties', "~> #{version}"
end
3 changes: 2 additions & 1 deletion jsonapi-resources.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.1'
spec.required_ruby_version = '>= 3.2'

spec.add_development_dependency 'bundler', '>= 1.5', '< 3.0'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'minitest-mock'
spec.add_development_dependency 'minitest-spec-rails'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'pry'
Expand Down
2 changes: 1 addition & 1 deletion lib/jsonapi/resources/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module JSONAPI
module Resources
VERSION = '0.1.2'
VERSION = '0.1.3'
end
end
8 changes: 4 additions & 4 deletions lib/jsonapi/routing_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def jsonapi_resource(*resources, &_block)
options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
end

resource @resource_type, options do
resource @resource_type, **options do
# :nocov:
if @scope.respond_to? :[]=
# Rails 4
Expand All @@ -51,7 +51,7 @@ def jsonapi_resource(*resources, &_block)
end
else
# Rails 5
jsonapi_resource_scope(SingletonResource.new(@resource_type, api_only?, @scope[:shallow], options), @resource_type) do
jsonapi_resource_scope(SingletonResource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
if block_given?
yield
else
Expand Down Expand Up @@ -107,7 +107,7 @@ def jsonapi_resources(*resources, &_block)
options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
end

resources @resource_type, options do
resources @resource_type, **options do
# :nocov:
if @scope.respond_to? :[]=
# Rails 4
Expand All @@ -119,7 +119,7 @@ def jsonapi_resources(*resources, &_block)
end
else
# Rails 5
jsonapi_resource_scope(Resource.new(@resource_type, api_only?, @scope[:shallow], options), @resource_type) do
jsonapi_resource_scope(Resource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
if block_given?
yield
else
Expand Down
5 changes: 5 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class TestApp < Rails::Application
config.active_record.time_zone_aware_types = [:time, :datetime]
config.active_record.belongs_to_required_by_default = false
end

# Use a modern cache serialization format to avoid Rails 7.2+ deprecations.
if Rails::VERSION::MAJOR >= 7 && config.active_support.respond_to?(:cache_format_version=)
config.active_support.cache_format_version = 7.1
end
end

module MyEngine
Expand Down