To clarify, here is the situation:
I am creating a really simple CMS, which will become the basis for several applications that I plan to create in the future. I would really like to create a page called "O" (which will be mostly static) and automatically have access to it in "/ about", without having to change route.rb.
I am currently using a template that works fine:
match '/*slug', :to => 'pages#dynamic_page',
:constraints => { :fullpath => /.+\.html/ }
The problem is that I really would like to omit the ".html" at the end. However, I prefer the extension to the URL, such as "/ pages / about". Is there a better way to handle this? The problem that occurs when deleting a constraint is that requests to elements that do not exist pass through the Rails router, which is clearly less than desired, since this is additional service data that needs to be processed.
Is there a better way? Is there a way to avoid the router completely if the requested page is a static page, so I can eliminate the lookup route?
Thank!
source
share