Sha256: ba5ca1fbe80055d33feb7383c8eb472607b814a284c9335599b95f83f3fc9452

Contents?: true

Size: 346 Bytes

Versions: 1

Compression:

Stored size: 346 Bytes

Contents

class Category < ActiveRecord::Base
  unloadable
  
  has_many :articles
  
  validates_presence_of :title
  validates_uniqueness_of :title
  
  named_scope :with, lambda { |many| {:joins => many.to_sym, :group => 'categories.id'} }
  
  before_save :set_url

private

  def set_url
    write_attribute :permalink, title.parameterize
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beef-articles-0.3.12 app/models/category.rb