marceloboeira/feedcast

View on GitHub
app/models/category.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
90%
class Category
  include Mongoid::Document
  include Mongoid::Slug

  field :title, type: String
  field :icon, type: String

  slug :title

  validates :title, presence: true
  validates :icon, presence: true, inclusion: { in: FontAwesome::ICONS }

  has_and_belongs_to_many :channels

  def icon_html
    FontAwesome::Icon.new(icon).to_html
  end
end