Sha256: 21ca551659d6d6fea522d290b4b111874b56caca427698d6bd0f784d290f0f43

Contents?: true

Size: 708 Bytes

Versions: 5

Compression:

Stored size: 708 Bytes

Contents

class Snippet < ActiveRecord::Base
  
  # Default Order
  order_by 'name'
  
  # Associations
  belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by'
  belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by'

  # 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_format_of :name, :with => %r{^\S*$}, :message => 'cannot contain spaces or tabs'
  validates_uniqueness_of :name, :message => 'name already in use'
  
  object_id_attr :filter, TextFilter

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-0.6.0 app/models/snippet.rb
radiant-0.6.1 app/models/snippet.rb
radiant-0.6.3 app/models/snippet.rb
radiant-0.6.2 app/models/snippet.rb
radiant-0.6.4 app/models/snippet.rb