2015-09-08 15:14:46 +02:00
|
|
|
class UsersController < ApplicationController
|
2015-09-08 17:40:40 +02:00
|
|
|
load_and_authorize_resource
|
|
|
|
|
2015-09-08 17:28:46 +02:00
|
|
|
def show
|
|
|
|
@user = User.find(params[:id])
|
2015-09-10 14:12:05 +02:00
|
|
|
@transaction = Transaction.new
|
2015-09-10 16:35:26 +02:00
|
|
|
|
|
|
|
gridparams = params[:transactions_grid] || Hash.new
|
|
|
|
gridparams = gridparams.merge(
|
|
|
|
order: :created_at,
|
|
|
|
descending: true,
|
|
|
|
current_user: current_user
|
|
|
|
)
|
|
|
|
@grid = TransactionsGrid.new(gridparams) do |scope|
|
|
|
|
scope.where('debtor_id = :id OR creditor_id = :id', id: current_user).page(params[:page])
|
2015-09-08 20:45:32 +02:00
|
|
|
end
|
2015-09-08 17:28:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def index
|
|
|
|
@users = User.all
|
|
|
|
end
|
2015-09-08 15:14:46 +02:00
|
|
|
end
|