hackers_controller.rb 812 Bytes
Newer Older
mafolz's avatar
mafolz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class HackersController < ApplicationController
  before_filter :set_hackers, :only => [:index]
  before_filter :set_hacker,  :only => [:show]

  before_filter :set_quests,  :only => [:show]
  before_filter :set_rewards, :only => [:show]
  before_filter :set_chronicle, :only => [:show]

  before_filter :authenticate_user!, :only => [:edit, :update]


  def index

  end

  def show
    
  end

  def edit
    current_hacker
  end


  private

  def set_hackers
    @hackers = Hacker.all
  end

  def set_hacker
    @hacker = Hacker.find(params[:id])
  end

  def set_quests
    @quests = Quest.all
  end

  def set_rewards
    @rewards = Reward.all
  end

  def set_chronicle
    @chronicle = (@hacker.earnings.all + @hacker.redemptions.all).sort do |a,b|
45
      b.created_at <=> a.created_at
mafolz's avatar
mafolz committed
46
47
48
    end
  end
end