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
32 33 34 35 36 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 32 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
46 47 48 49 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 46 def destroy @contact.destroy respond_on_destroy @contact, contact_url end |
#edit ⇒ Object
GET /contacts/1/edit
26 27 28 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 26 def edit 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
40 41 42 |
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 40 def update respond_on_update @contact, contact_params end |