class User < ActiveRecord::Base
  # Przetumaczone nazwy pl
  HUMANIZED_ATTRIBUTES = {
    :email => "Adres e-mail",
    :screen_name => "Pseudonim",
    :password => "Haso",
  }
  
  # Tumaczy nazwy pl
  def self.human_attribute_name(attr)
    HUMANIZED_ATTRIBUTES[attr.to_sym] || super
  end

  validates_uniqueness_of :screen_name, :email, :message => "jest ju zajty."
  validates_length_of     :screen_name, :within => 4..20, :too_short => "jest zbyt krtki (minimum to 4 znaki).", :too_long => "jest zbyt dugi (maksimum to 20 znakw)."
  validates_length_of     :password,    :within => 4..40, :too_short => "jest zbyt krtkie (minimum to 4 znaki).", :too_long => "jest zbyt dugie (maksimum to 40 znakw)."
  validates_length_of     :email,  :maximum => 50, :message => "jest zbyt dugi."
  validates_presence_of   :email, :message => "nie moe by pusty."
end