Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Chih-Wei Hsu11,132 Points
student_record ? a new table or a new column??
In the lesson where we create student_record to avoid duplicate usernames in the Student table, and then we use student_record.point to populate points. All of these seem like we've created a new table called student_record in the same database, with a column called student_record that holds the usernames, and a column called point in the student_record table. Is my understanding of student_record correct?? Or is student_record another column in the Student table, and student_record.point is also another column in the Student table??
Chris FreemanTreehouse Moderator 68,030 Points
In the line:
student_record = Student.get(username=student['username'])
student_record points to a specific saved instance of
student_record.points is the
points attribute of this instance. After adding the points values, this instance is saved in the
Student table using
student.save(). Said another way,
student_record points to a row in the
student_record.points points to the
points column in the
Student table for that row.
Ahmad Faris1,656 Points
I don't think it's possible using that line of code... because for each Student we have two attributes , namely username and points and using Student.get (student['username']) will throw an error