[RoR][REST] Announce: Restolog - RESTful blog example

I modified a little the original Alisdair McDiarmid’s RestBlog sources and created very simple blog system. Made an announce to the Rails ML. The copy of it follows:

Restolog - very simple blog system based on REST/CRUD ideas. Sources (all credits going to the authors, i just combined their work):

The purpose is mostly proof of concept, not typo/mephisto etc. competition.

Requirements

Features

  • Pretty CRUDed – using only standard action names (index,show,new,create,edit,update,destroy)
  • tags taxonomy – more flexible than categories
  • graceful delete degradation – you can delete without JS enabled
  • Multiuser:
    • only logged in users can post
    • user can delete only his own articles
    • user can delete only comments to his own articles
    • ‘admin’ user can delete everything
    • only ‘admin’ user can delete tags
  • blogs per tag ( /tags/? )
  • blogs per user ( /users/? )
  • RSS2.0/Atom feeds with suitable mime-types ( /articles.atom and /articles.rss )
  • Some REST services (more will come):
    • all articles ( /articles.xml )
    • specific article ( /articles/?.xml )
    • tags list ( /tags.xml )
    • still missing: users list, create/update (authentication) articles, articles per tag and per user, delete (hm, is it good to make delete web service at all?)

REST Problems (for me, not in general ;) ):

  • how to exclude fields from the XML output? For example @users.to_xml will include also the password field in the output.
  • how to deal with the action needed authentication – like create/update – usual way is to include some token in the URL, but how to do it with Rails?

Installation

  • Get the sources:
  • untar if needed
  • cd to the sources directory
  • Bind it to the Edge Rails, create the database and start it:
 rails freeze_edge
 rake migrate
 server/start
  • Create the user with login ’admin’ – power user, can delete everybody posts, comments, tags etc. (hm, maybe ’rake bootstrap’ step will be good)
  • Logout and create usual user
  • Start posting articles

Still a lot is missing (user management, password change, pagination, text markup – textile etc.), but I think it’s pretty good starting point.