7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/concerns/sufia/contact_form_controller_behavior.rb', line 7
def create
@contact_form = ContactForm.new(params[:contact_form])
@contact_form.request = request
if @contact_form.respond_to?(:deliver_now) ? @contact_form.deliver_now : @contact_form.deliver
flash.now[:notice] = 'Thank you for your message!'
after_deliver
render :new
else
flash.now[:error] = 'Sorry, this message was not sent successfully. '
flash.now[:error] << @contact_form.errors.full_messages.map(&:to_s).join(",")
render :new
end
rescue
flash.now[:error] = 'Sorry, this message was not delivered.'
render :new
end
|