Sha256: 5a10ab0edb794b9df4eab2f74a1e350afa08e46a565aa7a4848f11493544770b

Contents?: true

Size: 727 Bytes

Versions: 23

Compression:

Stored size: 727 Bytes

Contents

class Guest < ActiveRecord::Base
    
  validates_presence_of     :name
  validates_format_of       :name,     :with => /\A[^[:cntrl:]\\<>\/&]*\z/,  :message => 'avoid non-printing characters and \\&gt;&lt;&amp;/ please.'
  validates_length_of       :name,     :maximum => 100

  validates_presence_of     :email
  validates_length_of       :email,    :within => 6..100 #r@a.wk
  validates_format_of       :email,    :with => /\A[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)\z/i, :message => "should look like an email address."
  
  def website=(website)
    self[:website] = (website.blank? or website.starts_with? 'http://') ? website : 'http://' + website
  end
end

Version data entries

23 entries across 12 versions & 2 rubygems

Version Path
governor_comments-0.1.1 lib/generators/governor/templates/models/guest.rb
governor_comments-0.1.0 spec/rails_app/app/models/guest.rb
governor_comments-0.1.0 lib/generators/governor/templates/models/guest.rb