Sha256: 7620184f79f5a875760033de57838e58509b1077fc8452f9d427f4b9bc0e3cbe

Contents?: true

Size: 539 Bytes

Versions: 2

Compression:

Stored size: 539 Bytes

Contents

module Banyan
  class CategoryGroup < ActiveRecord::Base
    set_table_name 'banyan_category_groups'

    acts_as_nested_set
    translates :name

    belongs_to :group_categorizable, :polymorphic => true
    has_and_belongs_to_many :categories, :class_name => 'Banyan::Category', :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_group.rb
banyan-1.0.1 lib/banyan/category_group.rb