Arzee

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in How do I write the correct association?

If I wanted to have a "user_type" column in my "users" table that references to another table called "user_type", how do I write the correct association in rails? For example if my user_type is 1 and 1 is admin in my user_type table, and when I write

user = User.first
user.user_type # I want this to return admin

Thank you in advance