I have seen some examples of a 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 All examples I see in this way:
User.find (: all :, < = Code> Preferred But I do not see any examples of the use of relationships, would it be possible to do something like this instead?
User: (Relationships = & gt ;: User)
You class relationships Can not be used as management. This is the example methods.
< Code> User.find (: all ,: include = & gt;: preferred) or for Rail 3.x
> Code> User.includes (: Favorites)
Comments
Post a Comment