Class: InvoiceBar::AccountsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /accounts POST /accounts.json



33
34
35
36
37
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 33

def create
  @account = InvoiceBar::Account.new()
  current_user.accounts << @account
  respond_on_create @account
end

#destroyObject

DELETE /accounts/1 DELETE /accounts/1.json



47
48
49
50
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 47

def destroy
  @account.destroy
  respond_on_destroy @account, 
end

#editObject

GET /accounts/1/edit



27
28
29
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 27

def edit
  respond_on_edit @account
end

#indexObject

GET /accounts GET /accounts.json



9
10
11
12
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 9

def index
  @accounts = current_user.accounts.page(params[:page])
  respond_on_index @accounts
end

#newObject

GET /accounts/new



21
22
23
24
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 21

def new
  @account = InvoiceBar::Account.new
  respond_on_new @account
end

#showObject

GET /accounts/1 GET /accounts/1.json



16
17
18
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 16

def show
  respond_on_show @account
end

#updateObject

PATCH/PUT /accounts/1 PATCH/PUT /accounts/1.json



41
42
43
# File 'app/controllers/invoice_bar/accounts_controller.rb', line 41

def update
  respond_on_update @account, 
end