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" map.page "/:url", :controller => "content", :action => "page" # Good old catchalls! map.catcher "/*path", :controller => "content", :action => "catcher" end 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? RSL --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You might be able to get some insight from this example: http://typo.onxen.info/articles/2006/08/10/ann-restolog-restful-blog-example The article is from August, but the source seems to be actively updated. Sean On 1/9/07, Russell Norris <sconds-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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" > > map.page "/:url", :controller => "content", :action => "page" > # Good old catchalls! > map.catcher "/*path", :controller => "content", :action => "catcher" > end > > 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? > > RSL > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. RSL On 1/9/07, Sean Hussey <seanhussey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > You might be able to get some insight from this example: > > > http://typo.onxen.info/articles/2006/08/10/ann-restolog-restful-blog-example > > The article is from August, but the source seems to be actively updated. > > Sean > > On 1/9/07, Russell Norris <sconds-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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" > > > > map.page "/:url", :controller => "content", :action => "page" > > # Good old catchalls! > > map.catcher "/*path", :controller => "content", :action => "catcher" > > end > > > > 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? > > > > RSL > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---