Class: C80FeedbackForm::MessController

Inherits:
ApplicationController show all
Defined in:
app/controllers/c80_feedback_form/mess_controller.rb

Instance Method Summary collapse

Instance Method Details

#handle_message_feedbackObject

skip_before_filter :verify_authenticity_token



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/c80_feedback_form/mess_controller.rb', line 6

def handle_message_feedback
  puts "<MessController.handle_message_feedback>"
  m = MessageFeedback.new(mess_params)
  respond_to do |format|
    if m.save

      format.js
      MessageFeedbackMailer.send_mess(m, "Сообщение с сайта").deliver
    else
      puts "<MessController.handle_message_feedback> errors: #{m.errors}"
      format.js { render json: m.errors, status: :unprocessable_entity }
    end
  end
end

#mess_paramsObject



21
22
23
# File 'app/controllers/c80_feedback_form/mess_controller.rb', line 21

def mess_params
  params.require(:mess).permit(:name, :email_or_phone, :comment, :kapcha)
end