Class: AccountsController
- Inherits:
-
AuthorizedController
- Object
- InheritedResources::Base
- AuthorizedController
- AccountsController
- Defined in:
- app/controllers/accounts_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from AuthorizedController
Instance Method Details
#csv_bookings ⇒ Object
25 26 27 28 29 |
# File 'app/controllers/accounts_controller.rb', line 25 def csv_bookings @account = Account.find(params[:id]) @bookings = apply_scopes(Booking).by_account(@account) send_csv @bookings, :only => [:value_date, :title, :comments, :amount, 'credit_account.code', 'debit_account.code'], :filename => "%s-%s.csv" % [@account.code, @account.title] end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/accounts_controller.rb', line 6 def index @accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings) end |
#show ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/accounts_controller.rb', line 10 def show @account = Account.find(params[:id]) @bookings = apply_scopes(Booking).includes(:debit_account => :account_type, :credit_account => :account_type).by_account(@account) if params[:only_credit_bookings] @bookings = @bookings.where(:credit_account_id => @account.id) end if params[:only_debit_bookings] @bookings = @bookings.where(:debit_account_id => @account.id) end @bookings = @bookings.paginate(:page => params['page'], :per_page => params['per_page'], :order => 'value_date, id') show! end |