Commit 227bdd2d

mo khan <mo@mokhan.ca>
2015-01-11 15:44:03
parameterize slug.
1 parent 9fdc852
Changed files (1)
app
app/models/category.rb
@@ -2,7 +2,9 @@ class Category < ActiveRecord::Base
   has_many :creations
   default_scope -> { order(:slug) }
 
-  scope :by_slug, ->(category) { find_by(slug: category.downcase)}
+  scope :by_slug, ->(category) do
+    find_by(slug: category.downcase.parameterize)
+  end
 
   def to_param
     slug