Class: Finance::BankAccountsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/finance/bank_accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#importObject


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/finance/bank_accounts_controller.rb', line 8

def import
  @bank_account = BankAccount.find(params[:id])
  import_method = @bank_account.find_import_method
  if import_method
    count = import_method.call(@bank_account)
    redirect_to (@bank_account), notice: t('finance.bank_accounts.controller.import.notice', count: count)
  else
    # @todo add import for csv files as fallback
    redirect_to (@bank_account), alert: t('finance.bank_accounts.controller.import.no_import_method')
  end
rescue => error
  redirect_to (@bank_account), alert: t('errors.general_msg', msg: error.message)
end

#indexObject


3
4
5
6
# File 'app/controllers/finance/bank_accounts_controller.rb', line 3

def index
  @bank_accounts = BankAccount.order('name')
  redirect_to (@bank_accounts.first) if @bank_accounts.count == 1
end