Module: Api::Faq
- Extended by:
- ActiveSupport::Concern
- Included in:
- ChallengesController, PeerReviewsController, ProgramsController, SpacesController
- Defined in:
- app/controllers/concerns/api/faq.rb
Instance Method Summary collapse
- #faq_create ⇒ Object
- #faq_destroy ⇒ Object
- #faq_index ⇒ Object
- #faq_show ⇒ Object
- #faq_update ⇒ Object
Instance Method Details
#faq_create ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/concerns/api/faq.rb', line 21 def faq_create @document = Document.new(faq_params) if @document.save @obj.faq.documents << @document render json: @obj.faq, serializer: Api::FaqSerializer, status: :created else render json: @document.errors, status: :unprocessable_entity end end |
#faq_destroy ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/concerns/api/faq.rb', line 39 def faq_destroy if @document.destroy render json: @obj.faq, serializer: Api::FaqSerializer else render status: :unprocessable_entity end end |
#faq_index ⇒ Object
13 14 15 |
# File 'app/controllers/concerns/api/faq.rb', line 13 def faq_index render json: @obj.faq, serializer: Api::FaqSerializer end |
#faq_show ⇒ Object
17 18 19 |
# File 'app/controllers/concerns/api/faq.rb', line 17 def faq_show render json: @document, serializer: Api::DocumentSerializer end |
#faq_update ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/controllers/concerns/api/faq.rb', line 31 def faq_update if @document.update(faq_params) render json: @obj.faq, serializer: Api::FaqSerializer else render json: @document.errors, status: :unprocessable_entity end end |