Hi!
The method User.all returns an Array of users, not a single user.
I think you have to iterate over the array, using each.
@users.each { |u| u.name }
Everaldo
On Mon, Jun 20, 2011 at 1:33 PM, Yennie <[email protected]> wrote:
> Hi all, I have very basic error that i have no idea how to show
>
> I have user table
> id
> name
> add
> phone number
>
>
> then i select all in user table
> using => @users = User.all
>
> => @users.name
>
> it gives me undefined method name Array<.....>
>
> Please give me some advice..
>
>
> Thanks
>
> --
> 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.
>
>
--
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.