Sha256: d965b508bcd3bd52624fe91bd57a9b547f8325a39f48b0f36891ad2b78d2d5ab

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

module Banyan
  class Category < ActiveRecord::Base
    set_table_name 'banyan_categories'

    acts_as_nested_set
    translates :name

    has_many :categorizations, :class_name => 'Banyan::Categorization', :dependent => :destroy
    has_and_belongs_to_many :category_groups, :class_name => 'Banyan::CategoryGroup', :join_table => 'banyan_categories_category_groups', :include => :translations

    validates_presence_of :name

    attr_accessible :name, :tag

    before_save :set_tag, :unless => :tag?

    private

    def set_tag
      self.tag = name
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
banyan-1.1.1 lib/banyan/category.rb
banyan-1.0.1 lib/banyan/category.rb