diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f69ff81..aa020ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-18.04 strategy: matrix: - ruby: [2.4, 2.5, 2.6, 2.7] + ruby: [2.4, 2.5, 2.6, 2.7, 3.0] steps: - uses: actions/checkout@master diff --git a/lib/fast_jsonapi/helpers.rb b/lib/fast_jsonapi/helpers.rb index 600dad7..09a48fa 100644 --- a/lib/fast_jsonapi/helpers.rb +++ b/lib/fast_jsonapi/helpers.rb @@ -10,7 +10,7 @@ module FastJsonapi # from explictly defined procs/lambdas, so we can't deduce the number of # parameters from the array length. Instead, look for an unnamed # parameter in the first position just pass the record as the receiver obj. - if proc.parameters.length > 0 && proc.parameters.first[1].nil? + if proc.parameters.positive? && !proc.parameters.empty? proc.call(params.first) else proc.call(*params.take(proc.parameters.length)) diff --git a/lib/fast_jsonapi/relationship.rb b/lib/fast_jsonapi/relationship.rb index 31e804e..cc26d70 100644 --- a/lib/fast_jsonapi/relationship.rb +++ b/lib/fast_jsonapi/relationship.rb @@ -12,12 +12,7 @@ module FastJsonapi object_block:, serializer:, relationship_type:, - cached: false, - polymorphic:, - conditional_proc:, - transform_method:, - links:, - meta:, + polymorphic:, conditional_proc:, transform_method:, links:, meta:, cached: false, lazy_load_data: false ) @owner = owner diff --git a/lib/jsonapi/serializer/errors.rb b/lib/jsonapi/serializer/errors.rb index f5372a8..7272eec 100644 --- a/lib/jsonapi/serializer/errors.rb +++ b/lib/jsonapi/serializer/errors.rb @@ -3,6 +3,7 @@ module JSONAPI module Serializer class Error < StandardError; end + class UnsupportedIncludeError < Error attr_reader :include_item, :klass diff --git a/spec/fixtures/movie.rb b/spec/fixtures/movie.rb index 101616f..a8a086d 100644 --- a/spec/fixtures/movie.rb +++ b/spec/fixtures/movie.rb @@ -50,7 +50,7 @@ class MovieSerializer attribute :released_in_year, &:year attributes :name - attribute :release_year do |object, params| + attribute :release_year do |object, _params| object.year end