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

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

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

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

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.