Class: Admin::ApplicationAccountsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/application_accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /admin/application_accounts




16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/admin/application_accounts_controller.rb', line 16

def create
  @application_account = ApplicationAccount.new(params["application_account"])
  respond_to do |format|
    if @application_account.save
      flash[:notice] = 'New application account created'
    else
      flash[:notice] = 'There was error creating the application account.'
    end
    format.html { redirect_to :action => :index } # go back to index.haml
  end
end

#destroyObject

DELETE /admin/application_accounts/1




45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/admin/application_accounts_controller.rb', line 45

def destroy
  @application_account = ApplicationAccount.find(params["id"])
  respond_to do |format|
    if @application_account.destroy
      flash[:notice] = 'Application account deleted'
    else
      flash[:notice] = 'There was error deleting the application account.'
    end
    format.html { redirect_to :action => :index } # go back to index.haml
  end
end

#indexObject

GET /admin/application_accounts




7
8
9
10
11
12
# File 'app/controllers/admin/application_accounts_controller.rb', line 7

def index
  @application_accounts = ApplicationAccount.order(:created_at)
  respond_to do |format|
    format.html # index.html.haml
  end
end

#updateObject

PUT /admin/application_accounts/1




30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/admin/application_accounts_controller.rb', line 30

def update
  @application_account = ApplicationAccount.find(params["id"])
  @application_account.attributes = params["application_account"]
  respond_to do |format|
    if @application_account.save
      flash[:notice] = 'New application account created'
    else
      flash[:notice] = 'Please fill out the name and token'
    end
    format.html { redirect_to :action => :index } # go back to index.haml
  end
end