I have seen some examples of a All examples I see in this way: But I do not see any examples of the use of relationships, would it be possible to do something like this instead? You class relationships Can not be used as management. This is the example methods. or for Rail 3.x passing: hash value to any one in ActiveRecord Railway < Code> find methods However, I have not seen any examples that it is possible through methods of relationship or not. For example, suppose I have the following:
def user & lt; ActiveRecord :: Base has has_many: user_favorites has_many: favorites, via = & gt; : User_favorites end def favorites & lt; ActiveRecord :: Base has has_many: user_favorites has_many: users ,: through = & gt; : User_favorites end def UserFavorite & lt; ActiveRecord :: Base is_to: user is_to: Favorites end
User.find (: all :, < = Code> Preferred
User: (Relationships = & gt ;: User)
< Code> User.find (: all ,: include = & gt;: preferred)
> Code> User.includes (: Favorites)
Comments
Post a Comment