Class: PaidUp::FeatureSettingType
- Inherits:
-
Object
- Object
- PaidUp::FeatureSettingType
show all
- Includes:
- ActiveModel::AttributeMethods, ActiveModel::Model
- Defined in:
- lib/paid_up/feature_setting_type.rb
Overview
Feature Setting Type Class: Not an ActiveRecord object.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/paid_up/feature_setting_type.rb', line 10
def name
@name
end
|
#user ⇒ Object
Returns the value of attribute user.
10
11
12
|
# File 'lib/paid_up/feature_setting_type.rb', line 10
def user
@user
end
|
Instance Method Details
#ids ⇒ Object
29
30
31
|
# File 'lib/paid_up/feature_setting_type.rb', line 29
def ids
rows.ids
end
|
#model ⇒ Object
37
38
39
|
# File 'lib/paid_up/feature_setting_type.rb', line 37
def model
name.classify.constantize
end
|
#rows ⇒ Object
25
26
27
|
# File 'lib/paid_up/feature_setting_type.rb', line 25
def rows
scope.where(user: user)
end
|
#rows_allowed ⇒ Object
21
22
23
|
# File 'lib/paid_up/feature_setting_type.rb', line 21
def rows_allowed
plan.feature_setting name
end
|
#rows_count ⇒ Object
33
34
35
|
# File 'lib/paid_up/feature_setting_type.rb', line 33
def rows_count
rows.size
end
|
#rows_remaining ⇒ Object
17
18
19
|
# File 'lib/paid_up/feature_setting_type.rb', line 17
def rows_remaining
rows_allowed - rows_count
end
|
#rows_unlimited? ⇒ Boolean
13
14
15
|
# File 'lib/paid_up/feature_setting_type.rb', line 13
def rows_unlimited?
rows_allowed == PaidUp::Unlimited.to_i
end
|
#scope ⇒ Object
41
42
43
|
# File 'lib/paid_up/feature_setting_type.rb', line 41
def scope
model.paid_for_scope
end
|