Skip to content

Kernel methods get priority over delegate methods #215

Closed
@maltoe

Description

@maltoe

Hi,

Question: Due to the way exposures are looked up in the entity class first (calling respond_to attribute, true), attributes defined on the delegate class that collide with Kernel methods can not be exposed. We today noticed that with a AR model that has a belongs_to :system association. Probably poor wording on our side, but still: What would be the preferred way to deal with this? Currently we need to monkey-patch Grape::Entity#delegate_attribute.

class Foo < ActiveRecord::Base
  belongs_to :system

  class Entity < Grape::Entity
    expose :system
  end
end

Thanks,
Malte

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions