Class: Gamification::RewardsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/gamification/rewards_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/gamification/rewards_controller.rb', line 7

def create
  if rewarding.is_a? ::Gamification::Goal
    rewarding.complete_for rewardable
  else
    rewarding.goals.each do |goal|
      goal.complete_for rewardable
    end
  end

  respond_to do |format|
    format.json { render json: {}, status: :created }
    format.html { redirect_to redirect_url }
  end
end