Class: InvoiceBar::ContactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/invoice_bar/contacts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /contacts/1/edit



26
27
28
# File 'app/controllers/invoice_bar/contacts_controller.rb', line 26

def edit
  respond_on_edit @contact
end

#indexObject

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

#newObject

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

#showObject

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

#updateObject

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