मैं अंगूर इकाई फाइल के अंदर कई वर्गों करना चाहते हैं में प्रत्येक इकाई, इस फ़ोल्डर संरचना एप्लिकेशन/API/proj/API/v2/संस्थाओं/committees.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
और अंदर अंगूर एपीआई
present @committees, with: PROJ::API::V2::Entities::Committee
काम कर रहा है। लेकिन अगर मैं
present @committees, with: PROJ::API::V2::Entities::CommitteeList
के साथ पेश करता है यह काम नहीं कर रहा है। लेकिन यह तब काम करता है जब मैं इसे committee_list.rb
नाम की एक नई फ़ाइल में स्थानांतरित करता हूं।
फ़ाइल संरचना के साथ अपने मेरे लिए ठीक काम कर रहा है, लेकिन अगर मैं इस जैसी संरचना भी अपने काम नहीं कर रहा https://gist.github.com/anbublacky/a6e66217b2fcdeb52fe580864beecf7f –
अद्यतन सार कृपया सार के आधार पर –
अपडेट किया गया जवाब की जांच – anothermh