Class: Volt::User

Inherits:
Model show all
Defined in:
app/volt/models/user.rb

Instance Attribute Summary

Attributes inherited from Model

#attributes, #options, #parent, #path, #persistor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#!, #<<, #==, #_id, #_id=, #assign_attribute, #expand!, #initialize, #inspect, #method_missing, #new_array_model, #new_model, nosave, #read_attribute, #read_new_model

Methods included from Buffer

#buffer, #promise_for_errors, #save!

Methods included from ModelState

#change_state_to, #loaded?, #state

Methods included from Validations

#clear_server_errors, #errors, included, #mark_all_fields!, #mark_field!, #marked_errors, #marked_fields, #server_errors

Methods included from ModelHashBehaviour

#clear, #delete, #each, #each_pair, #each_with_object, #empty?, #false?, #key?, #keys, #nil?, #size, #to_h, #true?

Methods included from ModelHelpers

#class_at_path, #deep_unwrap, #event_added, #event_removed

Methods included from ModelWrapper

#wrap_value, #wrap_values

Constructor Details

This class inherits a constructor from Volt::Model

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Volt::Model

Class Method Details

.login_fieldObject

returns true if the user configured using the username



6
7
8
9
10
11
12
# File 'app/volt/models/user.rb', line 6

def self.
  if Volt.config.public.try(:auth).try(:use_username)
    :username
  else
    :email
  end
end

Instance Method Details

#password=(val) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/volt/models/user.rb', line 21

def password=(val)
  if Volt.server?
    # on the server, we bcrypt the password and store the result
    self._hashed_password = BCrypt::Password.create(val)
  else
    self._password = val
  end
end