[Rails] Re: Re: Associations join
Michael Pavling wrote in post #1065301:
> On 20 June 2012 08:51, Timen E. <lists@ruby-forum.com> wrote:
>>
>> undefined method `user' for #<Array:0x3c81ac8>
>> Extracted source (around line #3):
>
> @card is a collection of cards (that's how you populate it in the
> "show" action. If it needs to be a single card, you need to find it by
> ID (or some other attribute), if it's supposed to be a collection of
> every card, you need to iterate it in the view and print the user for
> each card.
aaah i see, nonetheless i noticed that i turned it around. I need to get
the user with it's cards, haha!
What you mentioned did work but it doesn't seem to 'associate' the right
way around because i'm getting the error SQLite3::SQLException: no such
column: cards.user_id: SELECT "cards".* FROM "cards" WHERE
"cards"."user_id" = 1"".
Shouldn't he query through cardlevels instead of cards?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home