On 8/2/06, Alisdair McDiarmid <alisdair@…> wrote:
Here you go:
http://randomoracle.com/stuff/RestBlog.tar.gz
Hi guys,
i modified a little the original Alisdair McDiarmid’s sources and
created very simple blog system. So the announce follows:
Restolog - RESTful blog example
Very simple blog system based on REST/CRUD ideas. Sources (all credits
going to the autors, i just combined their work):
- RestBlog by Alisdair McDiarmid - [
http://randomoracle.com/stuff/RestBlog.tar.gz ] - restful_authentication plugin by techno-weenie - [
http://svn.techno-weenie.net/projects/plugins/restful_authentication/
] - graseful delete degradation (delete without JavaScript enabled) - [
http://www.thelucid.com/articles/2006/07/26/simply-restful-the-missing-action
]
The purpose is mostly proof of concept, not typo/mephisto etc.
competition.
Requirements
- ruby-1.8.4 (i’m using mongrel, do you? )
- sqlite3
- edge rails
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.