Nesting resources under users?

I just wrote, in a post on a different topic:

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

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

I’ve rarely seen the above sort of thing (nesting things under users)
done, but it does make sense to me. What do y’all perceive as the
tradeoffs?

Thanks,
Dave


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

On Wed, Nov 23, 2011 at 6:57 PM, Dave A. <
[email protected]> wrote:

another question. I’ll start another thread for that.)

I’ve rarely seen the above sort of thing (nesting things under users)
done, but it does make sense to me. What do y’all perceive as the
tradeoffs?

Thanks,
Dave

Hi!

Try this:

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

I don’t think there is a reason for nesting. Are you using the generated
nested route paths? If you don’t, maybe there are no reason to use
nested
resources.

Best Regards,
Everaldo

On Wed, Nov 23, 2011 at 16:04, Everaldo G. [email protected]
wrote:

Try this:
resources :users
resources :decisions
resources :alternatives
resources :factors

That’s how I’ve already got the app working; the nested version was
something I wanted to try since it seemed more in tune with REST. See
my post under the thread “resource nesting for spreadsheet-like app?”.

In this thread here, I’m just looking for opinions on whether nesting
things under users is a good or bad thing, regardless of other
nesting.

Thanks,
Dave


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

On Nov 23, 4:18pm, Dave A. [email protected]
wrote:

See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

if you’re using a controller that NEEDS properties from a parent, use
nested routes. if you’re using a controller that can assume the
parent, or it can be contrived, don’t nest.

example:
users controller, using devise for authentication, giving you the
current_users variable
private information singleton controller for data being stored only
for the current user, and not to be seen by other users
contact information controller, which stores personal contact
information, some of which can be seen by all users, depending on
privacy settings

resources :users do
resources :contacts
end
resources :user_confidential

that’s how I approach it - however there is no right or wrong way to
do it. just remember routes provide information to a controller, and
aren’t necessarily a representation of models (though that’s a great
place to start).

hope that helps.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs