Learning REST: Multiple routes to the same resource?

I just started looking at REST, and am working on a simple app made up
from Authors and Books with an Author has_many :books relationship.

I'm thinking the following resources make sense:


I.e. listing books, listing authors, looking up a book or author,
listing books for a certain author, and accessing the author of some
specific book.

Is this reasonable, or am I already doing something wrong? I'm
guessing that /books/book_id/author may be a little over the top.

As for routes, I now have the following:

  map.resources :books do |book|
    book.resource :author
  map.resources :authors do |author|
    author.resources :books

According to rake routes, there's a fair amount of controller+action
duplication here.
Is this ok, should I be looking at parameters to figure out what to do?

Here's the index action from my books controller right now. This one
isn't too messy, but I'm sure other actions will turn out worse..?

  # GET /books[.xml]
  # GET /authors/author_id/books[.xml]
  def index
    if params[:author_id].nil?
      @books = Book.find(:all)
      @books = Author.find(params[:author_id]).books

    respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @books }

TBH I'm a little lost, and should probably be looking for books or
something. Recommendations appreciated.

Thank you,

try this one, lots of ruby examples

and this