Class: User
- Inherits:
-
Volt::Model
- Object
- Volt::Model
- User
- Defined in:
- app/volt/models/user.rb
Instance Attribute Summary
Attributes inherited from Volt::Model
#attributes, #options, #parent, #path, #persistor
Class Method Summary collapse
-
.login(username, password) ⇒ Object
Login the user, return a promise for success.
- .logout ⇒ Object
Instance Method Summary collapse
Methods inherited from Volt::Model
#!, #<<, #==, #_id, #_id=, #assign_attribute, #buffer, #expand!, #initialize, #inspect, #method_missing, #new_array_model, #new_model, nosave, #promise_for_errors, #read_attribute, #read_new_model, #return_undefined_method, #save!
Methods included from Volt::ModelState
#change_state_to, #loaded?, #state
Methods included from Volt::Validations
#clear_server_errors, #errors, included, #mark_all_fields!, #mark_field!, #marked_errors, #marked_fields, #server_errors
Methods included from Volt::ModelHashBehaviour
#clear, #delete, #each_with_object, #empty?, #false?, #keys, #nil?, #size, #to_h, #true?
Methods included from Volt::ModelHelpers
#class_at_path, #deep_unwrap, #event_added, #event_removed
Methods included from Volt::ModelWrapper
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(username, password) ⇒ Object
Login the user, return a promise for success
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/volt/models/user.rb', line 22 def self.login(username, password) puts "Login now" UserTasks.login(username, password).then do |result| puts "Got: #{result.inspect}" # Assign the user_id cookie for the user $page.._user_id = result # Pass nil back nil end end |
.logout ⇒ Object
35 36 37 |
# File 'app/volt/models/user.rb', line 35 def self.logout $page..delete(:user_id) end |