Class: ComfyImprint::ContactsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ComfyImprint::ContactsController
- Defined in:
- app/controllers/comfy_imprint/contacts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /contacts.
-
#destroy ⇒ Object
DELETE /contacts/1.
- #index ⇒ Object
-
#new ⇒ Object
GET /contacts/new.
- #thank_you ⇒ Object
Instance Method Details
#create ⇒ Object
POST /contacts
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 17 def create @contact = Contact.new(contact_params) if @contact.save # Contact Attempt passed validation so it's safe to mail it. # In the future I may want to impleme nt some kind of delayed_job or redis hook here ContactMailer.contact_email(@contact).deliver redirect_to :thank_you #, notice: 'Contact was successfully created.' else render action: :new end end |
#destroy ⇒ Object
DELETE /contacts/1
30 31 32 33 |
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 30 def destroy @contact.destroy redirect_to contacts_url#, notice: 'Contact was successfully destroyed.' end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 7 def index redirect_to root_path end |
#new ⇒ Object
GET /contacts/new
12 13 14 |
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 12 def new @contact = Contact.new end |
#thank_you ⇒ Object
35 36 |
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 35 def thank_you end |