I am having problems with my many to many relationships.
I have setup the appropriate connections, linking the join tables.
has_and_belongs_to_many :users, :join_table => "users_logins", :foreign_key => "login_id"
has_and_belongs_to_many ....
when I try to search using User.find(:all, :include => :login ...)
I get the result that I want, but when i try to do User.login.name it returns nomethod found
I have the basic User information, but I want to get all the login information, whet开发者_StackOverflow社区her it be 10 entries, but I cannot get the information to be viewable!! :(
User.login would be an array and hence the "nomethod" error . Try user.logins[0].name
or user.login[0].name
.
精彩评论