In my Rails app, I have a model Page which represents one HTML “article” about some aspect of my organisation.
Now, I would like to give some of these pages their own top-level URL like “/products” and “/contact-us”. However, I would prefer to do this in a dynamic (database-driven) way i.e. not have to add a match clause for each. The reason is I need to link to some pages in the main menu, but obviously don’t know which id number they will get in each deployment.
What would be the best-practice way of doing this?
in the end of routes.rb add
in page action use params[:page] to find page in db and render it using
if u r using haml ofc