Class: InvoiceBar::ContactsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- InvoiceBar::ContactsController
- Defined in:
- app/controllers/invoice_bar/contacts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /contacts POST /contacts.json.
-
#destroy ⇒ Object
DELETE /contacts/1 DELETE /contacts/1.json.
-
#edit ⇒ Object
GET /contacts/1/edit.
-
#index ⇒ Object
GET /contacts GET /contacts.json.
-
#new ⇒ Object
GET /contacts/new.
-
#show ⇒ Object
GET /contacts/1 GET /contacts/1.json.
-
#update ⇒ Object
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json.
Instance Method Details
#create ⇒ Object
POST /contacts POST /contacts.json
33 34 35 36 37 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 33 def create @contact = InvoiceBar::Contact.new(contact_params) current_user.contacts << @contact respond_on_create @contact end |
#destroy ⇒ Object
DELETE /contacts/1 DELETE /contacts/1.json
47 48 49 50 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 47 def destroy @contact.destroy respond_on_destroy @contact, contact_url end |
#edit ⇒ Object
GET /contacts/1/edit
26 27 28 29 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 26 def edit @contact.build_address unless @contact.address respond_on_edit @contact end |
#index ⇒ Object
GET /contacts GET /contacts.json
8 9 10 11 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 8 def index @contacts = current_user.contacts.page(params[:page]) respond_on_index @contacts end |
#new ⇒ Object
GET /contacts/new
20 21 22 23 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 20 def new @contact = InvoiceBar::Contact.new @contact.build_address end |
#show ⇒ Object
GET /contacts/1 GET /contacts/1.json
15 16 17 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 15 def show respond_on_show @contact end |
#update ⇒ Object
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json
41 42 43 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 41 def update respond_on_update @contact, contact_params end |