Class: User
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- User
- Defined in:
- app/models/user.rb
Constant Summary collapse
- PERSON_ATTR =
%w(name fname lname minitial prefix suffix email phone emails phones addresses birthdate age nationality language)
- PERSON_SYMS =
PERSON_ATTR.collect {|x| [x.to_sym, (x + "=").to_sym] }.flatten
- PERSON_SET =
PERSON_SYMS + PERSON_ATTR
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#assign_attributes(attr) ⇒ Object
26 27 28 29 |
# File 'app/models/user.rb', line 26 def assign_attributes(attr) self.person ||= Person.new if not attr.keys.to_set.intersection(PERSON_SET).empty? super(attr) end |
#organization ⇒ Object
22 23 24 |
# File 'app/models/user.rb', line 22 def organization self.organizations.order(created_at: :desc).first end |
#organization=(org) ⇒ Object
18 19 20 |
# File 'app/models/user.rb', line 18 def organization=(org) self.organizations << org if not self.organizations.include?(org) end |