metamaps--metamaps/app/models/user.rb

24 lines
768 B
Ruby
Raw Normal View History

2012-09-22 22:39:12 -04:00
require 'open-uri'
class User < ActiveRecord::Base
has_many :items
2012-10-17 20:51:54 -04:00
has_many :synapses
2012-09-22 22:39:12 -04:00
acts_as_authentic do |configuration|
configuration.session_class = Session
configuration.require_password_confirmation = false
configuration.merge_validates_format_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? }
configuration.merge_validates_length_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? }
2012-09-22 22:39:12 -04:00
end
validates :password, :presence => true,
:length => {:within => 6..20},
:on => :create
validates :password, :length => {:within => 6..20},
:allow_blank => true,
:on => :update
end