Module: Tomify::Concerns::User

Extended by:
ActiveSupport::Concern
Included in:
User
Defined in:
app/models/tomify/concerns/user.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



33
34
35
# File 'app/models/tomify/concerns/user.rb', line 33

def name
  "#{first_name} #{last_name}"
end

#serializable_hash(options = nil) ⇒ Object



45
46
47
48
# File 'app/models/tomify/concerns/user.rb', line 45

def serializable_hash(options = nil)
  options = { methods: [:name] } if options.blank?
  super options
end

#subscriptionObject



37
38
39
# File 'app/models/tomify/concerns/user.rb', line 37

def subscription
  Tomify.models.subscription.find_or_create_by(email: email)
end

#token(name = nil) ⇒ Object



41
42
43
# File 'app/models/tomify/concerns/user.rb', line 41

def token(name = nil)
  tokens.find_or_create_by(name: name)
end