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

View file

@ -1,14 +1,5 @@
## Changelog ## 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) ### 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). * [#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 gemspec
case version = ENV['GRAPE_VERSION'] || '~> 3.0.0' case version = ENV['GRAPE_VERSION'] || '~> 2.3.0'
when 'HEAD' when 'HEAD'
gem 'grape', github: 'intridea/grape' gem 'grape', github: 'intridea/grape'
else else

View file

@ -49,7 +49,11 @@ module Grape
end end
def innermost_scope 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 end
def meta_options def meta_options

View file

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

View file

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

View file

@ -52,18 +52,6 @@ describe Grape::ActiveModelSerializers::SerializerResolver do
expect(serializer).to be_kind_of(serializer_class) expect(serializer).to be_kind_of(serializer_class)
end 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 context 'each serializer' do
let(:options) { let(:options) {
super().except(:serializer).merge( super().except(:serializer).merge(

View file

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