Sha256: ff39dad2f0f369916e510d080af7ce8b57ff7a7419e8843d6dc9bc5eafae2bf9

Contents?: true

Size: 463 Bytes

Versions: 9

Compression:

Stored size: 463 Bytes

Contents

class TemplatePart < ActiveRecord::Base

  # Default Order
  default_scope :order => 'name'

  # Associations
  belongs_to :template
  belongs_to :part_type

 # Validations
  validates_presence_of :name, :part_type_id
  validates_exclusion_of :name, :in => %w{body}, :message => "cannot be named 'body'"

  def index
    @index ||=  new_record? ? "0#{rand(1000)}" : id
  end

  def part_type_name=(name)
    self.part_type = PartType.find_by_name(name)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
radiant-templates-extension-1.0.8 app/models/template_part.rb
radiant-templates-extension-1.0.7 app/models/template_part.rb
radiant-templates-extension-1.0.6 app/models/template_part.rb
radiant-templates-extension-1.0.5 app/models/template_part.rb
radiant-templates-extension-1.0.4 app/models/template_part.rb
radiant-templates-extension-1.0.3 app/models/template_part.rb
radiant-templates-extension-1.0.2 app/models/template_part.rb
radiant-templates-extension-1.0.1 app/models/template_part.rb
radiant-templates-extension-1.0.0 app/models/template_part.rb