Sha256: 2e1e93cd9deef47ab52c30c00639ecb9779b8ab6165e43c192b9665b3d87f633

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 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 => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/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
  alias_attribute :money_value, :money
  alias_attribute :receive_email_default, :receive_email
  alias_attribute :receive_email_image, :receive_email
  alias_attribute :description_simple, :description

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

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

  def zip_format
    nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
best_in_place-3.1.0 spec/internal/app/models/user.rb