On 20 June 2012 08:51, Timen E. <[email protected]> wrote:
> #card_controller.rb
> class CardController < ApplicationController
>  def show
>    @card = Card.all
>  end
> end
>
> <h1>Card#show</h1>
> <p>Find me in app/views/card/show.html.erb</p>
> <%= @card.user %>
>
> 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.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to