[Meddle CMS Dev Log] Routing errors impeding progress…

Commit: None

I haven’t pushed a commit as of yet because it seems I’m having issues with the current feature I’m working on. That feature is to Show pages with a "http://root/slug" formatted URL. Why is this proving difficult? Routing.

Routing errors may be a misnomer, but it so far seems to be the issue with my application. In our routes.rb file, I have Cms::Pages scoped under admin. My goal is to have every CRUD action with the exception of Read to be read in our path as /admin/cms/pages/page-slug, but it seems to cause an issue when using another controller to call on a Cms::Page record. Because Reading pages shouldn’t be an admin related task, I’ve created another controller to Show the pages, a controller that isn’t namespaced at all. And yet, ActiveRecord insists I’m experiencing a RECORD NOT FOUND error. In our Pages controller I have:

def show
@page = ::Cms::Page(params[:id])

The ::Cms reportedly instructs rails to search for a record from top-level. Any suggestions?

I have no solution as of yet, but will update soon when I have better information.

Share on FacebookTweet about this on TwitterShare on Google+Email this to someoneShare on RedditPrint this page
Bookmark the permalink.