Merge branch 'master' of https://github.com/ZeusWPI/Tab
This commit is contained in:
commit
a2ae293df0
3 changed files with 15 additions and 2 deletions
|
@ -7,6 +7,10 @@ class ApplicationController < ActionController::Base
|
|||
redirect_to root_url, alert: exception.message
|
||||
end
|
||||
|
||||
def current_client
|
||||
@current_client ||= identify_client
|
||||
end
|
||||
|
||||
def current_ability
|
||||
if current_user
|
||||
@current_ability ||= Ability.new(current_user)
|
||||
|
@ -14,4 +18,12 @@ class ApplicationController < ActionController::Base
|
|||
@current_ability ||= ClientAbility.new(current_account)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def identify_client
|
||||
key = request.headers["X-API-KEY"]
|
||||
Client.find_by key: key if key
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,8 @@ class TransactionsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@transaction = current_user.outgoing_transactions.build transaction_params.merge(origin: I18n.t('origin.created_by_user'))
|
||||
@transaction = current_user.outgoing_transactions.build(
|
||||
transaction_params.merge(origin: I18n.t('origin.created_by_user'))
|
||||
|
||||
if @transaction.save
|
||||
redirect_to current_user
|
||||
|
|
|
@ -2,7 +2,7 @@ class TransactionDatatable < AjaxDatatablesRails::Base
|
|||
include TransactionsHelper
|
||||
|
||||
def sortable_columns
|
||||
@sortable_columns ||= ['Transaction.amount']
|
||||
@sortable_columns ||= ['Transaction.created_at']
|
||||
end
|
||||
|
||||
def searchable_columns
|
||||
|
|
Loading…
Reference in a new issue