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