Rest and Tagging

Hi,

I’ve taken the plunge and am using the great new rest approach to
building my latest web-app extravaganza. So far so good, and the
examples I’ve seen on the web make perfect sense, the Peepcode video in
particular was a great help.

One area which I am struggling with though is how to fold the
requirement of tagging in to a restful app, infact now that I think
about it, my confusion about this might stem from some
less-than-perfect application design, so I’m throwing it out here and
hoping some nice Rails geniuses will be able to offer some advice.

Essentially my app has users, posts, tags and comments.

  • Users can make and tag posts.
  • Users should also have a page which show their posts and their tags,
    they also have a page for each of their tags showing just the posts
    tagged with that tag.
  • There’s a global page which shows all posts from all users.
  • There’s should also be global tag pages which shows just the posts
    tagged with that tag from all users.
  • Each post has a link to an individual post page which has comments.

So far so del.icio.us

Thus far I’ve got a ‘posts’ controller which is in charge of showing
all the posts from all users, and the general CRUD stuff for the ‘post’
model.

I’ve also got a ‘users’ controller, created by the
‘restful_authentication’ plugin, to which I’ve also added a ‘show’
action which is what I’ve used to show the posts of individual users,
although I’m not sure that this is where I should be doing this.

URL wise it looks something like this…

/posts → list all posts
/posts/1 → show post and comments
/users/1 → show all posts by user

So my next step is to get tagging working but I’m not sure what’s the
best way to go about doing this whilst still maintain the apps
restful-ness. Is the acts_as_taggable plugin suitable for this sort of
use?

Anybody who’s has any experience implementing tagging in a restful app
out there who can share some of their wisdom?

Many thanks,
Mike.