Class: Account

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::Document
Defined in:
lib/rad/models/account.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.currentObject



67
68
69
# File 'lib/rad/models/account.rb', line 67

def self.current
  Thread.current['current_account'].must_be.defined
end

.current=(account) ⇒ Object



63
64
65
# File 'lib/rad/models/account.rb', line 63

def self.current= 
  Thread.current['current_account'] = 
end

.current?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/rad/models/account.rb', line 71

def self.current?
  !!Thread.current['current_account']
end

Instance Method Details

#domains_as_stringObject

Form helpers



38
39
40
# File 'lib/rad/models/account.rb', line 38

def domains_as_string
  domains.join("\n")
end

#domains_as_string=(str) ⇒ Object



42
43
44
# File 'lib/rad/models/account.rb', line 42

def domains_as_string= str
  self.domains = str.split("\n") unless str.nil?    
end

#select(account_name, space_name = 'default') ⇒ Object



75
76
77
78
# File 'lib/rad/models/account.rb', line 75

def select , space_name = 'default'
  Account.current = Account.find_by_name! 
  Space.current = Account.current.spaces.find_by_name! space_name
end