Module: Saucy::Account::InstanceMethods
- Defined in:
- lib/saucy/account.rb
Instance Method Summary collapse
- #admin_emails ⇒ Object
- #expired? ⇒ Boolean
- #has_member?(user) ⇒ Boolean
- #memberships_by_name ⇒ Object
- #past_trial? ⇒ Boolean
- #projects_by_name ⇒ Object
- #projects_count ⇒ Object
- #projects_visible_to(user) ⇒ Object
- #set_trial_expiration ⇒ Object
- #to_param ⇒ Object
- #users_by_name ⇒ Object
- #users_count ⇒ Object
Instance Method Details
#admin_emails ⇒ Object
67 68 69 |
# File 'lib/saucy/account.rb', line 67 def admin_emails admins.map(&:email) end |
#expired? ⇒ Boolean
59 60 61 |
# File 'lib/saucy/account.rb', line 59 def expired? trial? && past_trial? end |
#has_member?(user) ⇒ Boolean
39 40 41 |
# File 'lib/saucy/account.rb', line 39 def has_member?(user) memberships.exists?(:user_id => user.id) end |
#memberships_by_name ⇒ Object
55 56 57 |
# File 'lib/saucy/account.rb', line 55 def memberships_by_name memberships.by_name end |
#past_trial? ⇒ 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_name ⇒ Object
47 48 49 |
# File 'lib/saucy/account.rb', line 47 def projects_by_name projects.by_name end |
#projects_count ⇒ Object
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_expiration ⇒ Object
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_param ⇒ Object
35 36 37 |
# File 'lib/saucy/account.rb', line 35 def to_param keyword end |
#users_by_name ⇒ Object
43 44 45 |
# File 'lib/saucy/account.rb', line 43 def users_by_name users.by_name end |
#users_count ⇒ Object
75 76 77 |
# File 'lib/saucy/account.rb', line 75 def users_count users.count end |