Class: SubscriptionCategory
- Inherits:
-
Object
- Object
- SubscriptionCategory
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/enums/subscription_category.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(code) ⇒ SubscriptionCategory
constructor
A new instance of SubscriptionCategory.
- #title ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(code) ⇒ SubscriptionCategory
Returns a new instance of SubscriptionCategory.
8 9 10 |
# File 'app/models/enums/subscription_category.rb', line 8 def initialize(code) @code = code.to_sym end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'app/models/enums/subscription_category.rb', line 6 def code @code end |
Instance Method Details
#title ⇒ Object
12 13 14 |
# File 'app/models/enums/subscription_category.rb', line 12 def title I18n.t(code, scope: [:subscriptions, :category]) end |
#to_param ⇒ Object
16 17 18 |
# File 'app/models/enums/subscription_category.rb', line 16 def to_param id end |