Class: Ideasbugs::SubmissionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ideasbugs::SubmissionsController
- Defined in:
- app/controllers/ideasbugs/submissions_controller.rb
Overview
The widget's write endpoint: POST /feedbacks.
Public, so it stays on ApplicationController and never inherits a host's admin base controller — someone filing a bug report must not be asked for a staff session. The triage actions live in FeedbacksController, which does inherit it.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/ideasbugs/submissions_controller.rb', line 24 def create feedback = Feedback.new(feedback_params) feedback.user_agent = request.user_agent feedback.tenant = current_tenant (feedback) error = attach_screenshots(feedback) return render json: { errors: [error] }, status: :unprocessable_entity if error if feedback.save notify_host(feedback) head :created else render json: { errors: feedback.errors. }, status: :unprocessable_entity end end |