summaryrefslogtreecommitdiff
path: root/app/models/badge.rb
blob: ee3de34d6647fb6dc9314722bb69004dd928f7b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Badge < ActiveRecord::Base
  include Comparable
  has_many :users

  def self.get (input)
    if input.is_a?(String) || input.is_a?(Symbol)
      Badge.find_by(name: input)
    elsif input.is_a?(Fixnum)
      Badge.find_by(id: input)
    elsif input.is_a?(Badge)
      return input
    end
  end

  def to_s
    self.name
  end
end