RESTful blog??

I’m curious if anyone has a better, more RESTful implementation of the usual blog/CMS methodology. I use REST for my admin controllers but
I’m not really sure if I’m actually exposing the record/resource or an interpretation of it [as the front page does].

Here’s a quick mockup of what I’ve been using in routes.rb

ActionController::Routing::Routes.draw do |map|

Content URLs

map.index “/”, :controller => “content”, :action => “index”

map.oops “/oops”, :controller => “content”, :action => “oops” # The catcher_url redirects here as a 404, kinda.
map.entry “/entry/:id/:title”, :controller => “content”, :action => “entry”

map.archives “/archives”, :controller => “content”, :action => “archives”
map.categorized “/archives/:category”, :controller => “content”, :action => “categorized”

The page route needs to be just before the catchall so it doesn’t try to handle the admin pages.

Admin URLs

map.admin “/admin”, :controller => “admin/common”, :action => “index”

map.resources :categories, :controller => “admin/categories”, :path_prefix => “/admin”, :name_prefix => “admin_”, :member => {:delete => :delete}
map.resources :entries, :controller => “admin/entries”, :path_prefix => “/admin”, :name_prefix => “admin_”, :member => {:delete => :delete, :publish => :post, :detach => :delete, :detag => :delete}, :collection => {:search => :get, :categorized => :get}

map.resources :pages, :controller => “admin/pages”, :path_prefix => “/admin”, :name_prefix => “admin_”, :member => {:delete => :delete, :publish => :post, :detach => :delete}, :collection => {:search => :get}

map.resources :users, :controller => “admin/users”, :path_prefix => “/admin”, :name_prefix => “admin_”
map.resources :sessions, :controller => “admin/session”, :path_prefix => “/admin”, :name_prefix => “admin_”, :collection => {:delete => :delete}

map.resources :addresses, :controller => “admin/addresses”, :path_prefix => “/admin”, :name_prefix => “admin_”, :member => {:delete => :delete}, :collection => {:search => :get, :email => :get}

map.admin_settings “/admin/settings”, :controller => “admin/settings”, :action => “index” “/:url”, :controller => “content”, :action => “page”

Good old catchalls!

map.catcher “/*path”, :controller => “content”, :action => “catcher”

Should I somehow be including the content URLs in on the REST goodness? To me, they’re two different apps kinda. The RESTful admin app and the regular reader one. Is this crazy though?


You might be able to get some insight from this example:

The article is from August, but the source seems to be actively updated.


Well, blow me down. That is some completely RESTful blogness there. I feel a little more comfortable in the way I’m doing things now. Especially since I’m trying to tackle [successfully tackling] multisite blogging/cms. I’m definitely interested in that code though. Thanks for pointing it out to me.