Compare commits

..

No commits in common. "master" and "v2.0.0" have entirely different histories.

8 changed files with 16 additions and 41 deletions

View file

@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0.0
ruby-version: 3.4.4
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run Danger
@ -21,18 +21,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [4.0.0, 3.4.8, 3.3.10, 3.2.9]
grape-version: ['~> 3.0.0', '~> 2.3.0']
ruby-version: [3.4.4, 3.3.8, 3.2.8, 3.1.7]
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
env:
GRAPE_VERSION: ${{ matrix.grape-version }}
- name: Run tests
run: bundle exec rake
env:
GRAPE_VERSION: ${{ matrix.grape-version }}

View file

@ -1,14 +1,5 @@
## Changelog
### 2.0.2 (Next)
* Your contribution here.
### 2.0.1 (2025/12/08)
* [#92](https://github.com/ruby-grape/grape-active_model_serializers/pull/92): Fix: accept nil serializer - [@mateusnava](https://github.com/mateusnava).
* [#100](https://github.com/ruby-grape/grape-active_model_serializers/pull/100): Fix compatibility with Grape 3.0 and test in CI - [@samsonjs](https://github.com/samsonjs).
### 2.0.0 (2025/06/02)
* [#96](https://github.com/ruby-grape/grape-active_model_serializers/pull/96): Add compatibility for Grape 2.3 - [@samsonjs](https://github.com/samsonjs).

View file

@ -2,7 +2,7 @@ source 'https://rubygems.org'
gemspec
case version = ENV['GRAPE_VERSION'] || '~> 3.0.0'
case version = ENV['GRAPE_VERSION'] || '~> 2.3.0'
when 'HEAD'
gem 'grape', github: 'intridea/grape'
else

View file

@ -49,7 +49,11 @@ module Grape
end
def innermost_scope
endpoint.inheritable_setting.namespace_stackable[:namespace]&.last
if endpoint.respond_to?(:namespace_stackable)
endpoint.namespace_stackable(:namespace).last
else
endpoint.settings.peek[:namespace]
end
end
def meta_options

View file

@ -17,14 +17,12 @@ module Grape
def serializer_class
return @serializer_class if defined?(@serializer_class)
return nil if options.key?(:serializer) && options[:serializer].nil?
@serializer_class = resource_defined_class ||
collection_class ||
options[:serializer] ||
namespace_inferred_class ||
version_inferred_class ||
resource_serializer_class
@serializer_class = resource_defined_class
@serializer_class ||= collection_class
@serializer_class ||= options[:serializer]
@serializer_class ||= namespace_inferred_class
@serializer_class ||= version_inferred_class
@serializer_class ||= resource_serializer_class
end
def serializer_options

View file

@ -1,5 +1,5 @@
module Grape
module ActiveModelSerializers
VERSION = '2.0.2'.freeze
VERSION = '2.0.0'.freeze
end
end

View file

@ -52,18 +52,6 @@ describe Grape::ActiveModelSerializers::SerializerResolver do
expect(serializer).to be_kind_of(serializer_class)
end
context 'specified nil by options' do
let(:options) {
super().merge(
serializer: nil
)
}
it 'returns nil' do
expect(serializer).to be_nil
end
end
context 'each serializer' do
let(:options) {
super().except(:serializer).merge(

View file

@ -22,7 +22,6 @@ describe 'Sequel Integration' do
let!(:model) {
SequelUser = Class.new(Sequel::Model(:users)) do
include ActiveModel::Serialization
def self.model_name
'User'
end