On Fri, Jun 10, 2011 at 12:23 PM, Dheeraj Kumar <[email protected]>wrote:
> Simple. You get only one picture object (the first one) because you're > using .first method. Since you have only one object, you can't iterate over > it using the each loop. Get it? > > Just use @user.image instead in the view :) > > or remove the .first if you want to display all user images. maybe it's just me but i suggest you rename your variables. given the error you had undefined method `each' for #<Picture:0x927dea0> it would be easier if you change @user to @pictures. > > On Fri, Jun 10, 2011 at 9:46 AM, joanne <[email protected]> wrote: > >> hi all, >> >> I have an error "undefined method `each' for #<Picture:0x927dea0>" >> what is that mean? >> >> in my view >> [code] >> >> <% @user.each do |p| %> >> <%= p.image %> >> <% end %> >> >> [/code] >> >> >> in controller >> [code] >> @user=picture.all( >> :joins => :culture, >> :conditions => (Album.joins(:description))).first >> >> [/code] >> >> >> plz give me some advance >> >> -- >> 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. > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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 [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.

