Class: Admin::FinancialTransactionClassesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/financial_transaction_classes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
# File 'app/controllers/admin/financial_transaction_classes_controller.rb', line 9

def create
  @financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
  if @financial_transaction_class.save
    redirect_to update_transaction_types_admin_finances_url, status: 303
  else
    render action: 'new', layout: false
  end
end

#destroyObject


33
34
35
36
37
38
39
40
# File 'app/controllers/admin/financial_transaction_classes_controller.rb', line 33

def destroy
  @financial_transaction_class = FinancialTransactionClass.find(params[:id])
  @financial_transaction_class.destroy!
  redirect_to update_transaction_types_admin_finances_url, status: 303
rescue => error
  flash.now[:alert] = error.message
  render template: 'shared/alert'
end

#editObject


18
19
20
21
# File 'app/controllers/admin/financial_transaction_classes_controller.rb', line 18

def edit
  @financial_transaction_class = FinancialTransactionClass.find(params[:id])
  render action: 'new', layout: false
end

#newObject


4
5
6
7
# File 'app/controllers/admin/financial_transaction_classes_controller.rb', line 4

def new
  @financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
  render layout: false
end

#updateObject


23
24
25
26
27
28
29
30
31
# File 'app/controllers/admin/financial_transaction_classes_controller.rb', line 23

def update
  @financial_transaction_class = FinancialTransactionClass.find(params[:id])

  if @financial_transaction_class.update_attributes(params[:financial_transaction_class])
    redirect_to update_transaction_types_admin_finances_url, status: 303
  else
    render action: 'new', layout: false
  end
end