Class: SimpleContact::ContactController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- SimpleContact::ContactController
- Defined in:
- app/controllers/simple_contact/contact_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/simple_contact/contact_controller.rb', line 9 def create @message = SimpleContact::Message.new(params[:message]) if @message.valid? SimpleContact::ContactMailer.(@message).deliver redirect_to main_app.root_path, notice: I18n.translate(:mailer_success_message) else flash.now.alert = I18n.translate(:mailer_error_message) render :new end end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/simple_contact/contact_controller.rb', line 5 def new @message = SimpleContact::Message.new end |