Class: Maquina::Current

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
app/models/maquina/current.rb

Instance Method Summary collapse

Instance Method Details

#active_session=(value) ⇒ Object



12
13
14
15
16
# File 'app/models/maquina/current.rb', line 12

def active_session=(value)
  super
  self.user = value&.user
  self.membership = user.default_membership
end

#management?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/maquina/current.rb', line 18

def management?
  user.management?
end

#signed_in?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'app/models/maquina/current.rb', line 7

def signed_in?
  return false if active_session.blank?
  !active_session.expired? && !active_session.blocked?
end