mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
34 lines
513 B
Ruby
34 lines
513 B
Ruby
class AttributeCategory < ActiveRecord::Base
|
|
validates :name, presence: true
|
|
|
|
belongs_to :user
|
|
has_many :attribute_fields
|
|
|
|
include HasAttributes
|
|
include Serendipitous::Concern
|
|
|
|
before_validation :ensure_name
|
|
|
|
def self.color
|
|
'amber'
|
|
end
|
|
|
|
def self.icon
|
|
'tab'
|
|
end
|
|
|
|
def self.content_name
|
|
'attribute_category'
|
|
end
|
|
|
|
def icon
|
|
self['icon'] || self.class.icon
|
|
end
|
|
|
|
private
|
|
|
|
def ensure_name
|
|
self.name ||= "#{label}-#{Time.now.to_i}".underscore.gsub(' ', '_')
|
|
end
|
|
end
|