quest.rb 413 Bytes
Newer Older
mafolz's avatar
mafolz committed
1
2
3
4
5
6
7
8
9
# enconding: UTF-8

##
# Eine zu lösende Aufgabe, z.B. 'Müll rausbringen' oder 'Boden wischen'
class Quest < ActiveRecord::Base

  validates :points, :title, :presence => true

  validates :points, :numericality => {:greater_than => 0}
surma Lodur's avatar
surma Lodur committed
10

11
12
13
14
  def solve(hacker, user = nil)
    hacker.earnings.create({
      :user => user,
      :points => self.points,
15
      :chronicle_text => self.title
16
17
    })
  end # #solve
mafolz's avatar
mafolz committed
18
end