app/controllers/debts_controller.rb
## Index ##
#  Index of all debt and XLS & CSV export
#  Responds to xls and csv format and uses pagination
Index
Index of all debt and XLS & CSV export
Responds to xls and csv format and uses pagination
Index Index of all debt and XLS & CSV export Responds to xls and csv format and uses pagination
def index
    assign_current_user
    case params['format']
    when 'csv', 'xls', 'xlsx'
      @debts_all = Debt.all
    else
      @debts_all = Debt.paginate(page: params[:page], per_page: 10)
    end
    respond_to do |format|
      format.html
      format.xls
      format.xlsx
      format.csv { send_data @debts_all.to_csv }
    end
  end
def index assign_current_user case params [ 'format' ] when 'csv' , 'xls' , 'xlsx' @debts_all = Debt . all else @debts_all = Debt . paginate ( page : params [ :page ] , per_page : 10 ) end respond_to do | format | format . html format . xls format . xlsx format . csv { send_data @debts_all . to_csv } end end
Index
Index of all debt and XLS & CSV export
Responds to xls and csv format and uses pagination
Index Index of all debt and XLS & CSV export Responds to xls and csv format and uses pagination