REST doesn’t really apply to the model level, as far as I know (I’m a
noob myself with the concept). It’s at the controller level.
Set up your habtm models normally, using the Agile Rails book as an
example if necessary.
Then implement your RESTful routes which will give you URLs like this:
The routes would look like this:
map.resources :films do |film|
film.resources :genres, :prefix_path => ‘film_’
map.resources :genres do |genre|
genre.resources :films, :prefix_path => ‘genre_’
This will allow you to use helpers like film_genres_path(@film) to link
to a list of genres for a specific film. Or, “form_for :film, :url =>
genre_films_path(@genre)” to add a new film to a genre. This last
command may need (@genre,nil) as arguments I’ve found… the RESTful
stuff seems to sometimes need a blank argument explicitly when there are
similar routes configured.