2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-07-16 22:25:16 -04:00
|
|
|
class BadgeGrouping < ActiveRecord::Base
|
2014-07-18 01:46:36 -04:00
|
|
|
GettingStarted = 1
|
|
|
|
Community = 2
|
|
|
|
Posting = 3
|
|
|
|
TrustLevel = 4
|
|
|
|
Other = 5
|
2014-07-17 02:10:44 -04:00
|
|
|
|
2014-07-16 22:25:16 -04:00
|
|
|
has_many :badges
|
2014-07-26 21:33:33 -04:00
|
|
|
|
2023-05-11 05:33:00 -04:00
|
|
|
validates :name, length: { maximum: 100 }
|
|
|
|
validates :description, length: { maximum: 500 }
|
|
|
|
|
2014-07-27 04:22:01 -04:00
|
|
|
def system?
|
2015-12-26 17:58:54 -05:00
|
|
|
id && id <= 5
|
2014-07-27 04:22:01 -04:00
|
|
|
end
|
|
|
|
|
2014-07-26 21:33:33 -04:00
|
|
|
def default_position=(pos)
|
2014-07-27 04:32:04 -04:00
|
|
|
self.position ||= pos
|
2014-07-26 21:33:33 -04:00
|
|
|
end
|
2014-07-16 22:25:16 -04:00
|
|
|
end
|
2014-07-17 02:10:44 -04:00
|
|
|
|
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: badge_groupings
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
2019-01-11 14:29:56 -05:00
|
|
|
# name :string not null
|
2014-07-21 22:46:31 -04:00
|
|
|
# description :text
|
2014-07-17 02:10:44 -04:00
|
|
|
# position :integer not null
|
2014-08-27 01:19:25 -04:00
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2014-07-17 02:10:44 -04:00
|
|
|
#
|