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