Sha256: 117e45d20dc237598cd5a9578dddbedaf14653c0d5676292d5b80bab0274aa6c
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
class AccountsController < AuthorizedController # Scopes has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] } has_scope :by_text def index @accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings) end 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 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bookyt-0.0.1 | app/controllers/accounts_controller.rb |