Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdam Zuckerberg
22,248 PointsWhy do statuses belong to documents?
Shouldn't documents belong_to :statuses ?
How can a user's status belong to a file?
1 Answer
Maciej Czuchnowski
36,441 PointsI know it sounds weird, this would make me raise an eyebrow a few months month ago, but after watching one of GoRails videos I know that the only thing belongs_to does is it gives you a setter and getter for this attribute, so you can check and apply things more easily (in this case it's status.document and status.document=). Check out from minute 12:55: https://gorails.com/episodes/soft-delete-with-paranoia
At least that's how I understand the reason behind belongs_to in this case.