Class: Cats::Core::StackTransactionsController

Inherits:
ApplicationController show all
Includes:
Common
Defined in:
app/controllers/cats/core/stack_transactions_controller.rb

Instance Method Summary collapse

Methods included from Common

#create, #show, #update

Methods inherited from ApplicationController

#authenticate, #current_user, #skip_bullet

Instance Method Details

#commitObject



18
19
20
21
22
# File 'app/controllers/cats/core/stack_transactions_controller.rb', line 18

def commit
  transaction = set_object
  transaction.commit
  render json: {success: true, data: serialize(transaction)}
end

#filterObject



13
14
15
16
# File 'app/controllers/cats/core/stack_transactions_controller.rb', line 13

def filter
  query = StackTransaction.includes(:source, :destination, :unit).ransack(params[:q])
  render json: {success: true, data: serialize(query.result)}
end

#indexObject



6
7
8
9
10
11
# File 'app/controllers/cats/core/stack_transactions_controller.rb', line 6

def index
  super do
    StackTransaction.includes(:unit, :destination, source: :store)
                    .where(cats_core_stacks: {cats_core_stores: {warehouse_id: params[:id]}})
  end
end