Class: Europeana::FeedbackButton::FeedbackController

Inherits:
ApplicationController show all
Defined in:
app/controllers/europeana/feedback_button/feedback_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/europeana/feedback_button/feedback_controller.rb', line 6

def create
  feedback = Feedback.new(feedback_params)

  feedback.validate

  unless feedback.valid?
    fail ApplicationError.new('Feedback is invalid. See "errors" for details.',
                              errors: feedback.errors.messages)
  end

  FeedbackMailer.post(**mailer_post_args).deliver_later

  respond_to do |format|
    format.json { render json: { success: true } }
  end
end