I have a polymorphic tag and want to search ambigous items by this tag.
How can I return this whith Grape Entity?
class Tag < ActiveRecord::Base
belongs_to :taggable, polymorphic: true
end
class Article < ActiveRecord::Base
has_many :tags, as: :taggable
end
class Post < ActiveRecord::Base
has_many :tags, as: :taggable
end
module Api
module Entities
class Tag < Grape::Entity
expose :lable
expose :taggable # HELP: , using Api::Entities::<polymorphic>
end
end
I need to define the Entity of taggable
to expose a Swagger aka OpenAPI interface.