Basically I am trying to display @arts = @users.arts, where User has many arts and @users is a plurality of users. I am getting back and undefined method for arts. Thanks in advance
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re not able to do this because you’re calling an instance method on something that’s not an instance. A “plurality of users” in this case is a sort of Array, and it does not have the
artsrelationship defined. What you need is:You can also use other more advanced methods to collect all of these in one query but that should be a start.