Class: ParseUserValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/parse_resource/parse_user_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



2
3
4
5
6
7
# File 'lib/parse_resource/parse_user_validator.rb', line 2

def validate(record)
  @user = User.where(:username => record.username)
  if @user.length > 0
    record.errors[:username] << "is already taken."
  end
end