Topic: Better URL's/Less Coding
There has got to be a better way to create pages than the method I am currently using. Currently I use the existing code to render each page.
@pages = Page.find_faq_page
@page = Page.find(:first, :conditions => ["name = ? and active = ?", "faq", 1 ])
<%= @pages.body %>
<%= render :partial => 'navigation' %>
The name is always a unique name in the db (basically a permalink). Can I define something in my routes.rb file so that the DB lookup is done based on the /:name section? I just don't want to create every single piece as it means I have to create a few lines of code if I ever decide to add another page into the database.
I basically want to create pretty URL's with as little code as possible and without repeating myself for every page.