Skip to content

Instantly share code, notes, and snippets.

@jonpaul
Created June 17, 2011 14:17
Show Gist options
  • Save jonpaul/1031496 to your computer and use it in GitHub Desktop.
Save jonpaul/1031496 to your computer and use it in GitHub Desktop.
Returns 'could not find page with ID=page-title'
def to_param
"#{title.downcase.gsub(/[^a-zA-Z0-9]+/, '-').gsub(/-{2,}/, '-').gsub(/^-|-$/, '')}"
end
def show
@page = Page.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @page }
end
end
resources :pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment