I have other undefined method when i combine the code above together
<%@users = User.all%>
<%@users.each do |u|%>
<%u.culture_id%>
<% @pic= Picture.where(:phrase_id => :route , :culture_id =>
u.culture_id).first%>
<td>My picture <%= @pic.image%></td>
and it causes undefined method image
please give me advices.... thank you so much
Joanne
On Mon, Jun 20, 2011 at 12:48 PM, joanne ta <[email protected]> wrote:
> thanks
>
> On Mon, Jun 20, 2011 at 12:38 PM, Everaldo Gomes <[email protected]
> > wrote:
>
>> 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
>>>
>>
Joanne
>
>>> --
>>> 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.
>>
>
>
>
>
--
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.