Sha256: 060a79a2e91415a9f8f423d668cc0f6ee81dc448437bfb98f9e63558603c0566

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 Bytes

Contents

#:nodoc:
module Categories
  #:nodoc:
  module Models
    ##
    # Model that represents a single category group. Each category group
    # has the following relations to other models:
    #
    # * categories (one to many)
    # * sections (many to many)
    #
    # When saving or creating a category group the "name" field is required
    # and should be no longer than 255 characters.
    #
    class CategoryGroup < Sequel::Model
      one_to_many  :categories, :class => "Categories::Models::Category"
      many_to_many :sections  , :class => "Sections::Models::Section"
      
      ##
      # Validation rules for our model.
      #
      # @author Yorick Peterse
      # @since  0.1
      #
      def validate
        validates_presence        :name
        validates_max_length 255, :name
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.2.4.1 lib/zen/package/categories/lib/categories/model/category_group.rb
zen-0.2.4 lib/zen/package/categories/lib/categories/model/category_group.rb
zen-0.2.3 lib/zen/package/categories/lib/categories/model/category_group.rb
zen-0.2 lib/zen/package/categories/lib/categories/model/category_group.rb