pretty item urls
This commit is contained in:
parent
6940e098d3
commit
c18a333bd2
3 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue