Sha256: d53872750dd2d1d2c1f64d8b6dc20ecc882bf252480ecca0dc40d043913c907d

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

class Snippet < ActiveRecord::Base

  # 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'
  
  registered_attr :filter, TextFilter

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.5.0 app/models/snippet.rb
radiant-0.5.1 app/models/snippet.rb
radiant-0.5.2 app/models/snippet.rb