ruby-grape / grape-entity

An API focused facade that sits on top of an object model.
MIT License
721 stars 153 forks source link

expose_nil option doesn't respect Entity.hash_access #358

Closed magni- closed 3 years ago

magni- commented 3 years ago

Reproduction steps

class A < Grape::Entity
  self.hash_access = :to_s

  expose :a
  expose :b, expose_nil: false
end

A.represent({ 'a' => 1, 'b' => 2 }).as_json
# expected: { a: 1, b: 2 }
# actual:   { a: 1 }