1
0
Fork 0
forked from OpenNeo/impress

pretty item urls

This commit is contained in:
Emi Matchu 2011-05-20 19:29:04 -04:00
parent 6940e098d3
commit c18a333bd2
3 changed files with 12 additions and 0 deletions

View file

@ -156,6 +156,14 @@ class Item < ActiveRecord::Base
}
end
def name_for_url
name.downcase.gsub(' ', '-')
end
def to_param
"#{id}-#{name_for_url}"
end
before_create do
self.sold_in_mall ||= false
true

View file

@ -1,4 +1,7 @@
- title @item.name
- content_for :meta do
%link{:rel => 'canonical', :href => url_for(@item)}
%header
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
%div

View file

@ -9,6 +9,7 @@
/[if IE]
= include_javascript_libraries :html5
= stylesheet_link_tag "compiled/screen"
= yield :meta
= csrf_meta_tag
= signed_in_meta_tag
%body{:class => body_class}