Say, for example, that I have 2 resources
Author has_many Books and
Book belongs_to Author.
This means that by doing the following:
# routes.rb resources :books resources :authors do resources :books end
I will have two routes that point to
GET /books and 2)
Consider the scenario where we don't care about all the books, only the list of books from a given author (effectively putting route #1 out of use).
BooksController#index with logic that goes something like:
# BooksController.rb def index @books = Book.where(author: author) render json: @books end
Author scoping is leaving me quite uncomfortable seeing as it is a general
BooksController, where the other CRUD methods have nothing to do with
Authors. Should something like the above #index method be in a separate, namespaced controller like