I’ve been working my way through Rails 3 In Action and one element is confusing me.
Why doesn’t User have a has_many association declared with Projects? Project has_many Tickets. What is it about the relationship between User and Project that differs from the relationship between Project and Ticket?
I would post code, but I think this question will only make sense to someone who has worked through the book (and therefore has the code to refer to).
A user never needs to have many projects, because the way that projects are shown to a user is through a scope on the
Projectmodel. If you wanted to have this association, then you will need to have auser_idattribute on theProjectinstances.