This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
redstoner.com/app/models/badge.rb
2017-07-10 21:26:15 +02:00

20 lines
372 B
Ruby

class Badge < ActiveRecord::Base
include Comparable
has_many :users
has_and_belongs_to_many :forums
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