associations

Hello everybody,

I've got the following setup:

table request {
id,
site_id,
department_id
}

table site {
id,
site_name
}

table users {
site_id,
user_id,
user_department_id
}

So, my models are as follows:

Model "request"

I like it! So there’s no way to get to the request object out of either the site or users model?

Thanks, Steve.

Steve, thanks once again. But I meant this: after I’ve created a new request and have a new request object, is there a way to access THAT particular object out of an instance of site or an instance of user since they are all connected with the model relationships? As I understand it, when I create a request object, the site and user objects are sort of also created and so there should be a way to go from user to site, to request, shouldn’t there? But I don’t mean through class methods, I mean through object methods. Does it make sense?

Steve,

Thanks for a comprehensive reply. I agree with what you’re saying. Basically, since there’s no relationship between objects except for the foreign_key/id kind, it would be impractical to find a request from either “site” or “users”. That makes sense and I’m glad you suggested the excellent workaround in your first reply. Thanks a bunch.

Sergei