Sha256: 8a92311b33ab6b53247983a9526f403ee806006bf37033aff3d6d53b8e8c6947

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

class User < ActiveRecord::Base
  validates :name,
    :length => { :minimum => 2, :maximum => 24, :message => "has invalid length"},
    :presence => {:message => "can't be blank"}
  validates :last_name,
    :length => { :minimum => 2, :maximum => 50, :message => "has invalid length"},
    :presence => {:message => "can't be blank"}
  validates :address,
    :length => { :minimum => 5, :message => "too short length"},
    :presence => {:message => "can't be blank"}
  validates :email,
    :presence => {:message => "can't be blank"},
    :format => {:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => "has wrong email format"}
  validates :zip, :numericality => true, :length => { :minimum => 5 }
  validates_numericality_of :money, :allow_blank => true
  validates_numericality_of :money_proc, :allow_blank => true

  alias_attribute :money_custom, :money

  def address_format
    "<b>addr => [#{address}]</b>".html_safe
  end

  def markdown_desc
    RDiscount.new(description).to_html.html_safe
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
very_best_in_place-2.0.3 test_app/app/models/user.rb
best_in_place-2.1.0 test_app/app/models/user.rb
best_in_place-2.0.3 test_app/app/models/user.rb
best_in_place-2.0.2 test_app/app/models/user.rb
best_in_place-2.0.1 test_app/app/models/user.rb
best_in_place-2.0.0 test_app/app/models/user.rb
best_in_place-1.1.3 test_app/app/models/user.rb