Sha256: 8ef7f1bb5dcc9547a27afe1dda5c541f42eac276740fa237d33819cc542440b0

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

class Kuhsaft::LocalizedPage < ActiveRecord::Base
  belongs_to :page
  has_many :page_parts, :class_name => 'Kuhsaft::PagePart::Content'
  before_validation :create_slug  
  
  validates :title, :presence => true
  validates :locale, :presence => true
  validates :slug, :presence => true
  
  def locale
    read_attribute(:locale).to_sym unless read_attribute(:locale).nil?
  end
  
  def create_slug
    if title.present? && slug.blank?
      write_attribute(:slug, read_attribute(:title).downcase.parameterize)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kuhsaft-0.0.3 app/models/kuhsaft/localized_page.rb