Sha256: 8e41b6c9412f1974e13fdc0390e2676042434e1f208d49c6c0befe63e84c6313
Contents?: true
Size: 431 Bytes
Versions: 7
Compression:
Stored size: 431 Bytes
Contents
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
7 entries across 7 versions & 1 rubygems