Class: Gamification::RewardsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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