Displaying 1 result from an estimated 1 matches for "show_by_slug".
2005 Mar 05
3
routes inconsistency?
...ly.
First, I added a column to my table, "slug", which is a short, unique
keyword to identify each page. Then I added this field to my edit
template and adjusted the model to properly validate it''s uniqueness &
length. Afterwards, I added this method to my controller:
def show_by_slug
@page = Page.find_by_slug(@params[''slug''].sub(/.shtml$/, ""))
render_action ''show''
end
And finally, I added this to my routes:
map.connect '':slug'', :controller => ''pages'', :action => ''show_b...