Sha256: a60471c2d269a52524273966e6fdb29d3f0ee0ad9b9a4209286868cc6eaa0fca

Contents?: true

Size: 639 Bytes

Versions: 3

Compression:

Stored size: 639 Bytes

Contents

class PagePart < ActiveRecord::Base
  
  # Default Order
  order_by 'name'
  
  # Associations
  belongs_to :page
  
  # Validations
  validates_presence_of :name, :message => 'required'
  validates_length_of :name, :maximum => 100, :message => '%d-character limit'
  validates_length_of :filter_id, :maximum => 25, :allow_nil => true, :message => '%d-character limit'
  validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true, :message => 'must be a number'
  
  object_id_attr :filter, TextFilter

  def after_initialize
    self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 app/models/page_part.rb
radiant-0.7.0 app/models/page_part.rb
radiant-0.7.1 app/models/page_part.rb