Resource nesting for spreadsheet-like app?

I’ve got a simple app that looks like a spreadsheet, currently working
with unnested routing. I would like to redo it with nesting, but
there is a resource that belongs to two higher level resources, and
I am unsure what the Conventional Wisdom is – other than the
admonishment not to nest more than one level deep, which I’m going to
ignore for the purpose of this experiment. (Google isn’t turning up
anything useful with the search “(rails OR ror) (spreadsheet OR matrix
OR grid) nested restful (routes OR resources)” – sans quotes of
course – in the first however many results before my eyes glaze


I have an app called The Decider (available at Each User can have many Decisions,
which are things like “what car should I buy”, “where should I go on
vacation”, etc.). These in turn have Alternatives (Accord, Prius,
F150 pickup, take the bus instead, etc.), and Factors (price, comfort,
reliability, mileage, etc.). The canonical nesting so far would be:

resources :users
resources :decisions
resources :alternatives
resources :factors

(Whether things should be nested under users in the first place, is
another question. I’ll start another thread for that.)

Then come Ratings. These are to describe how a given Alternative
rates in a given Factor (e.g., the bus has very bad speed, the Accord
has good reliability, etc.).

The most logical routing seems to be to specify both the Alternative
and the Factor, preferably in either order, and then tack on /rating
as a singular resource, resulting in URLs like:


to both refer to the same rating. If I understand rightly, that
should be achievable with a pair of routes like:

=> ‘rating#show’
=> ‘rating#show’

in which rating#show would find the right Rating from the Alternative
and Factor ids, but that seems like a lot of complication to go
through (and I’m not sure it’s even workable).

So I figured that before plunging down that rabbit-hole, not only
should I ask here, but also consider other ideas. I think putting it
under just one or the other doesn’t make sense, since the controller
needs to know both in order to find the right Rating. Another idea is
to let the resource be plural, directly under Decisions, and just
forget about having the URL indicate which combo I want, but that
seems to eliminate one of the big benefits of REST.

Or should I just forget about nesting (since I do have it working
without any really horrible kluges), or what?

If it helps: I don’t intend for Alternatives, Factors, or Ratings to
be CRUD-able outside the context of editing a Decision. (Currently
decisions#show is the spreadsheet-like display where the Ratings are
edited, while Alternatives and Factors are CRUD-ed in lists in
controller#edit, but I intend to move show’s functionality into edit,
and have the spreadsheet be the one and only view of any of the


LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern
Where: Northern Virginia, Washington DC (near Orange Line), and remote
See: (main) * (code) *
Specialization is for insects. (Heinlein) - Have Pun, Will Babble!