Sha256: 43caeaa7a41297926e752c4aae78d8959e0a98606e5dad1d514aa3dde722c53a
Contents?: true
Size: 650 Bytes
Versions: 4
Compression:
Stored size: 650 Bytes
Contents
module Droom class Category < ActiveRecord::Base attr_accessible :name, :description, :slug belongs_to :created_by, :class_name => "Droom::User" has_many :document_attachments before_validation :ensure_slug validates :slug, :presence => true, :uniqueness => true default_scope order("droom_categories.name ASC") # *for_selection* returns a set of [name, id] pairs suitable for use as select options. def self.for_selection self.all.map{|c| [c.name, c.id] } end protected def ensure_slug ensure_presence_and_uniqueness_of(:slug, name.parameterize) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
droom-0.4.3 | app/models/droom/category.rb |
droom-0.4.2 | app/models/droom/category.rb |
droom-0.4.1 | app/models/droom/category.rb |
droom-0.2.1 | app/models/droom/category.rb |