Class: FeaturedWork
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FeaturedWork
- Defined in:
- app/models/featured_work.rb
Constant Summary collapse
- FEATURE_LIMIT =
5
Instance Attribute Summary collapse
-
#presenter ⇒ Object
Returns the value of attribute presenter.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#presenter ⇒ Object
Returns the value of attribute presenter.
13 14 15 |
# File 'app/models/featured_work.rb', line 13 def presenter @presenter end |
Class Method Details
.can_create_another? ⇒ Boolean
16 17 18 |
# File 'app/models/featured_work.rb', line 16 def can_create_another? FeaturedWork.count < FEATURE_LIMIT end |
Instance Method Details
#count_within_limit ⇒ Object
8 9 10 11 |
# File 'app/models/featured_work.rb', line 8 def count_within_limit return if FeaturedWork.can_create_another? errors.add(:base, "Limited to #{FEATURE_LIMIT} featured works.") end |