Currently i'm using grape and grape entity, the current following structure works fine.
# app/api/proj/api/v2/entities/committee.rb
module PROJ::API::V2::Entities
class Committee < Grape::Entity; end
end
# app/api/proj/api/v2/entities/committee_base.rb
module PROJ::API::V2::Entities
class CommitteeBase; end
end
# app/api/proj/api/v2/entities/committee_with_subcommittee.rb
module PROJ::API::V2::Entities
class CommitteeWithSubcommittee < CommitteeBase; end
end
# app/api/proj/api/v2/entities/committee_list.rb
module PROJ::API::V2::Entities
class CommitteeList < CommitteeBase; end
end
But when i have the following structure i'm getting uninitialized constant error.
module PROJ::API::V2::Entities
class CommitteeBase < Grape::Entity;
expose :id
end
class CommitteeOffice < CommitteeBase;
expose :name
end
end
present @committees, with: PROJ::API::V2::Entities::CommitteeOffice
Error:
uninitialized constant PROJ::API::V2::Entities::CommitteeOffice
How can i load committee office?
Aucun commentaire:
Enregistrer un commentaire