Class: Blast::Contacts::ContactsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Blast::Contacts::ContactsController
- Defined in:
- app/controllers/blast/contacts/contacts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 22 def create @contact = Contact.new(contact_params) @contact.user = current_user if @contact.save # Add blast to access the correct path redirect_to [blast, @contact], notice: 'Contact was successfully created.' else render :new end end |
#destroy ⇒ Object
45 46 47 48 49 50 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 45 def destroy @contact.destroy # Add blast to access the correct path redirect_to blast.contacts_url, notice: 'Contact was successfully destroyed.' end |
#edit ⇒ Object
19 20 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 19 def edit end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 8 def index @contacts = current_user.contacts end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 15 def new @contact = Contact.new end |
#show ⇒ Object
12 13 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 12 def show end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/blast/contacts/contacts_controller.rb', line 35 def update if @contact.update(contact_params) # Add blast to access the correct path redirect_to [blast, @contact], notice: 'Contact was successfully updated.' else render :edit end end |