class Actn::Api::User

Attributes

password[RW]
password_confirmation[RW]

Public Class Methods

find_for_auth(params) click to toggle source
# File lib/actn/api/user.rb, line 16
def self.find_for_auth params
  return unless user = self.find_by('email' => params['email'])
  return unless user.password == params['password']
  user.uuid
end

Public Instance Methods

to_json(options = {}) click to toggle source
Calls superclass method
# File lib/actn/api/user.rb, line 41
def to_json options = {}
  super(options.merge(:exclude [:hash]))
end

Private Instance Methods

set_password() click to toggle source
# File lib/actn/api/user.rb, line 47
def set_password
  @password = BCrypt::Password.create(self.password)
  self.hash = @password
end
validate_unique_email() click to toggle source
# File lib/actn/api/user.rb, line 53
def validate_unique_email
  errors.add(:email, "has already been taken") if self.class.find_by('email' => self.email)
end