Sha256: 1198fe3172578428cabcef2db2843c79046fb6813277d652c7c25db0b41dd7c7
Contents?: true
Size: 833 Bytes
Versions: 1
Compression:
Stored size: 833 Bytes
Contents
# == Schema Information # # Table name: notee_categories # # id :integer not null, primary key # name :string default("category_name"), not null # slug :string default("2016-19-26-54"), not null # parent_id :integer # status :integer default(0), not null # created_at :datetime not null # updated_at :datetime not null # module Notee class Category < ActiveRecord::Base # callbacks before_save :set_slug before_destroy :protect_default # relations has_many :children, class_name: Notee::Category, foreign_key: 'parent_id', dependent: :destroy private def set_slug self.slug = self.name.downcase unless self.slug.present? end def protect_default return false if self.id == 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notee-0.4.0 | app/models/notee/category.rb |