Hello! I have three models, User, Type and TypeDescription, and as you can see below, each User may have many types, but each type has only one description. So as optimization, I thought each TypeDescription should be joined with Type via JOIN in sql, so I used default_scope and defined join, and that works when I get type via Type.find( id ), but when I use user = User.find( 1 ), each type in user.types doesn't have data from TypeDescription, because default_scope just adds defined options to methods like find, all etc. So what I'm looking for is solution to have this work in my situation, so what I want is, when I get certain or all users, I want to have all User's types and each type should have data from TypeDescription.
so, code is:
class User
has_many :types
end
class Type
has_one :type_description
default_scope :joins => :type_description
end
class TypeDescription
belongs_to :type
end
Thanks!