[Meddle CMS Dev Log] Finally, success! Sort of…

Last Commit: To be updated, I haven’t had a chance to push yet!

After two excruciating weeks of trial and error, reading and re-reading through my code and pulling out my hair, I finally figured out the problem. Well, actually I didn’t figure it out, I asked for the help of an amazing coder and my mentor, Andrew Kalek. He showed me something that blew my mind and made me hate myself for not seeing it sooner. It was a simple /. Yup, that’s the big piece that was missing. Let’s recap, shall we?

With the help Ryan Bates and his RailsCast #63, Model Name in Url, I was able to clean up our URLs by adding a slug to the Pages model. However, I didn’t want our users to see “/pages/ in the URL. So what’s a perilous programmer to do? To the routes.rb file-mobile!


# routes.rb
resources :pages, path: "", only: [:show]

Do you see it? My colossal mistake? Here’s the solution:


# routes.rb
resources :pages, path: "/", only: [:show]

Yup. That fixed everything. For static pages, I piggy backed off of the existing Pages_Controller and added an index (which you don’t see up top because it’s mapped with a root_to method) and will soon add others (Credits and whatnot.)

I also removed all of the System_Settings including table, controllers, models, etc. I just wasn’t happy with the outcome, but will be using the same idea soon. What wasn’t I happy about? The slug value record format only aloud for strings, and that was a no go. Any suggestions? Leave them in the comments section below! Please! Or drop a note over at the Meddle Repository!

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