Sha256: b4994361af5243558f36918e8a4702c129faa880cc5437fa372c27956daf8f99

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

class UserRegistrationForm

  include Model::NonPersistent

  field :full_name, type: String
  field :email, type: String
  field :password, type: String

  validates_presence_of :full_name, :email, :password, :password_confirmation
  validates_confirmation_of :password
  validates_format_of :email, with: /@/, message: :invalid_format

  # validates uniqueness of provider & uid (email) among all users
  validate do |record|
    if User.elem_match( :authentications => { :provider => :password, :uid => record.email } ).count > 0
      record.errors.add :email, :taken
    elsif User.elem_match( :emails => { :email => record.email } ).count > 0
      record.errors.add :email, :taken
    end
  end


end # class UserRegistrationForm

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aerogel-users-1.4.3 db/model/user_registration_form.rb