Module: Saucy::Account::InstanceMethods

Defined in:
lib/saucy/account.rb

Instance Method Summary collapse

Instance Method Details

#admin_emailsObject



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

def admin_emails
  admins.map(&:email)
end

#expired?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/saucy/account.rb', line 59

def expired?
  trial? && past_trial?
end

#has_member?(user) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/saucy/account.rb', line 39

def has_member?(user)
  memberships.exists?(:user_id => user.id)
end

#memberships_by_nameObject



55
56
57
# File 'lib/saucy/account.rb', line 55

def memberships_by_name
  memberships.by_name
end

#past_trial?Boolean

Returns:

  • (Boolean)


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

def past_trial?
  trial_expires_at && trial_expires_at < Time.now
end

#projects_by_nameObject



47
48
49
# File 'lib/saucy/account.rb', line 47

def projects_by_name
  projects.by_name
end

#projects_countObject



79
80
81
# File 'lib/saucy/account.rb', line 79

def projects_count
  projects.active.count
end

#projects_visible_to(user) ⇒ Object



51
52
53
# File 'lib/saucy/account.rb', line 51

def projects_visible_to(user)
  projects.visible_to(user)
end

#set_trial_expirationObject



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

def set_trial_expiration
  self.trial_expires_at = 30.days.from_now(created_at || Time.now)
end

#to_paramObject



35
36
37
# File 'lib/saucy/account.rb', line 35

def to_param
  keyword
end

#users_by_nameObject



43
44
45
# File 'lib/saucy/account.rb', line 43

def users_by_name
  users.by_name
end

#users_countObject



75
76
77
# File 'lib/saucy/account.rb', line 75

def users_count
  users.count
end