How to present one namespace model with grape-entity?

308 Views Asked by At

I have one namespace model like this :

class Message::Notification < Message
end

And I define one entity like this:

class Message::Notification < Grape::Entity
   expose :id
end

There is a error when present the model:

    present @notification, with: Entities::Message::Notification

Error:

app/models/message/notification.rb:1:in `': superclass mismatch for class Notification (TypeError)

1

There are 1 best solutions below

0
On BEST ANSWER

You are redefining the same class with a different superclass. It looks to me like your second definition should be in a module Entities.