Sha256: 1bb56dee29fd7586f30ca57d85472df0dcc6ef2cf25004bd200c643b0df8800c

Contents?: true

Size: 388 Bytes

Versions: 1

Compression:

Stored size: 388 Bytes

Contents

class ContentCategory < ActiveRecord::Base
  validates_presence_of :name
  validates_uniqueness_of :name

  before_save :update_permalink

  has_many :content_parts, :foreign_key => 'category_id', :dependent => :nullify

  named_scope :by_name, lambda { |name| { :conditions => { :name => name}}}

  protected

  def update_permalink
    self.permalink = self.name.parameterize
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree-cms-0.1.0 app/models/content_category.rb