Sha256: 8814e448a040d5522db2a59b6bb09a0edade3adfee544d4e4f1bab1bd12155f6

Contents?: true

Size: 305 Bytes

Versions: 2

Compression:

Stored size: 305 Bytes

Contents

module Notee
  class Category < ActiveRecord::Base

    # callbacks
    before_save :set_slug

    # relations
    has_many :children, class_name: Notee::Category, :foreign_key => 'parent_id', dependent: :destroy

    def set_slug
      self.slug = self.name.downcase if self.slug.nil?
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notee-0.3.0 app/models/notee/category.rb
notee-0.2.9 app/models/notee/category.rb