Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Can i have multiple call inside single module

Aperta
#267 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
api

Direzione di ricerca

Start with app/api/proj/api/v2/entities/committee.rb and compare the defined Committee and CommitteeWithSubcommittees classes with the Grape present calls. Check the corresponding standalone committee_list.rb file and determine whether the intended entity name is CommitteeWithSubcommittees or CommitteeList. Done means the intended entity can be referenced from the single file without breaking presentation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I want to have multiple classes inside grape entity file, this is the folder structure app/api/proj/api/v2/entities/committee.rb

module PROJ::API::V2::Entities
class Committee < Grape::Entity
expose :id

expose :name, :full_name, :email, :tag, :parent_id

expose :country do |entity, option|
entity.parent.name if entity.parent.present?
end

include Urls

private
def self.namespace_path
"committees"
end
end

class CommitteeWithSubcommittees < CommitteeBase
# include ProfilePhoto
expose :suboffices, with: 'PROJ::API::V2::Entities::CommitteeBase'
end
and inside the grape api

present @committees, with: PROJ::API::V2::Entities::Committee
is working. but if i present with

present @committees, with: PROJ::API::V2::Entities::CommitteeList
it is not working. But it works when i move it to a new file named committee_list.rb inside entities

Lingua principale
Ruby
Stelle
730
Fork
155
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby-grape/grape-entity

Tutte le issue di ruby-grape/grape-entity

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.