master
 1class Category < ApplicationRecord
 2  has_many :creations
 3  default_scope -> { order(:slug) }
 4
 5  scope :by_slug, ->(category) do
 6    find_by(slug: category.downcase.parameterize)
 7  end
 8
 9  def to_param
10    slug
11  end
12end