Skip to content

Issue with conditionals when extending base Serializable::Resource class directly in 0.2.1 #80

@richmolj

Description

@richmolj

I believe this commit, which changed from prepend to extend, broke the conditional support. I noticed this when trying to upgrade jsonapi_compliable - my if procs no longer get called, which broke extra_fields support.

The expectation is that I will get this overridden #requested_attributes, but debugging the code I see this is never called. The original #requested_attributes method is called.

I'm not sure how specs are passing, because this script mimics the same pattern and illustrates the problem:

class Foo
  def bar
    'original bar'
  end
end

module Mix
  def self.extended(klass)
    klass.class_eval do
      include InstanceMethods
    end
  end

  module InstanceMethods
    def bar
      'overridden bar'
    end
  end
end
Foo.extend Mix
puts Foo.new.bar #=> 'original'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions