Let me get this straight. You have users. Users have Stuff. You want a page,
say, where a given user can see just their Stuff, and nobody else's?

Well, you'd want to make your User have_many :stuffs, and your Stuffs
belong_to :user . This'll require a user_id column in your Stuffs table.

Then, finding the Stuff for a certain user is as easy as
"User.find(id).stuffs" . I forget if restful_authentication has a
current_user helper, I use AuthLogic, and so I'd just say
"current_user.stuffs"

But you probably don't want to make a whole second set of controllers just
for "MyStuffs", unless some stuffs don't belong to a user, but they can
still modify them. It's hard to understand the relationship with such
generic terms.

If all stuffs belong to a user, then you probably want to make Stuffs a
nested resouce of users. See the Railscast on the topic, it might be what
you're looking for.

http://railscasts.com/episodes/139-nested-resources
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to