Class: Subscription
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Subscription
- Includes:
- ActiveModel::ForbiddenAttributesProtection
- Defined in:
- app/models/subscription.rb
Constant Summary
- WEIGHTS =
Weight Levels
{ # A very frequent chance of content showing up. :very frequently" => 5, # A frequent chance of content showing up. :frequently => 4, # Neither a frequent, nor an infrequent chance of # content showing up. :no preference" => 3, # An infrequent chance of content showing up. :rarely => 2, # A very infrequent chance of content showing up. :very rarely" => 1, }
Instance Method Summary (collapse)
-
- (Object) contents
Get an array of all the approved active content to be shown in a screen's field.
-
- (Object) weight_name
Get weight name of a subscription.
Instance Method Details
- (Object) contents
Get an array of all the approved active content to be shown in a screen's field.
34 35 36 |
# File 'app/models/subscription.rb', line 34 def contents self.feed.approved_contents.active.where(:kind_id => self.field.kind.id) end |
- (Object) weight_name
Get weight name of a subscription
29 30 31 |
# File 'app/models/subscription.rb', line 29 def weight_name name = (Subscription::WEIGHTS.respond_to?(:key) ? Subscription::WEIGHTS.key(weight) : Subscription::WEIGHTS.index(weight)).to_s end |