Class: Spree::Admin::LoyaltyPointsTransactionsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/admin/loyalty_points_transactions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/spree/admin/loyalty_points_transactions_controller.rb', line 14

def create
  invoke_callbacks(:create, :before)
  @object.attributes = loyalty_points_transaction_params
  if @object.save
    invoke_callbacks(:create, :after)
    respond_with(@object) do |format|
      format.html { redirect_to location_after_save, success: flash_message_for(@object, :successfully_created) }
      format.js   { render layout: false }
    end
  else
    invoke_callbacks(:create, :fails)
    respond_with(@object) do |format|
      format.html { render action: :new }
    end
  end
end

#order_transactionsObject



8
9
10
11
12
# File 'app/controllers/spree/admin/loyalty_points_transactions_controller.rb', line 8

def order_transactions
  order = Spree::Order.find_by(id: params[:order_id])
  @loyalty_points_transactions = @user.loyalty_points_transactions.for_order(order).includes(:source).order(updated_at: :desc)
  respond_with @loyalty_points_transactions
end