Sha256: 64faf50e433a809b864768e2d99eb6b4fda7b958071ef636d21874c6de49a92c
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true module Europeana module FeedbackButton class FeedbackController < Europeana::FeedbackButton::ApplicationController 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 private def feedback_params @feedback_params ||= params.permit(:text, :type, :page, :email, :privacy_policy) end def mailer_post_args feedback_params.to_h.symbolize_keys.slice(:text, :type, :page, :email) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems