REST and habtm relationship

Tim McIntyre wrote:

I've got a habtm relationship that I'd really like to control RESTfully but I'm not sure how best to handle it.

films <=> genres

I can't come up with any logical model for a hmt relationship. How would you handle that? Create a films_genres model perhaps? Is there a better way?

From my understanding, the RESTful way of doing this would be to create

a join model, perhaps called Categorisation, and then use that instead of a HABTM. If you created a Categorisation model that belongs to both film and genre, with both of those having has_many xxx, :through => :categorisation. You can then create a Categorisations Controller with the relevant CRUD methods to handle the film <=> genre relationship. For example, creating a new Categorisation effectively relates to assigning a particular genre to a film.

Ben