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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
3dd13
2011-Jun-10 04:19 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
you exectued people.all.first so the @user only has one picture object instead of an array of pictures 2011/6/10 joanne <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Dheeraj Kumar
2011-Jun-10 04:23 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
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 :) On Fri, Jun 10, 2011 at 9:46 AM, joanne <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Ruther Nill
2011-Jun-10 04:34 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
On Fri, Jun 10, 2011 at 12:23 PM, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
joanne ta
2011-Jun-10 14:47 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
Thanks all. :D.. and i have other question.. when i take the image file (BLOD).. i cannot display it .. do you have any idea... Please give me some advice.. thanks ....\ On Fri, Jun 10, 2011 at 12:19 AM, 3dd13 <tatonlto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you exectued people.all.first > so the @user only has one picture object > instead of an array of pictures > > > > 2011/6/10 joanne <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- -------------------------------- Thank you, Yen -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2011-Jun-10 14:50 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
On 10 June 2011 15:47, joanne ta <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> and i have other question..If you have another question, please start another thread.> when i take the image file (BLOD).. i cannot > display it .. do you have any idea... > Please give me some advice.. thanks ....\How do you ''take it''? What code are you using to display it, and what errors do you get? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
joanne ta
2011-Jun-10 14:53 UTC
Re: error of "undefined method `each'' for #<Picture:0x927dea0>"
i am have any error about the code.. but i cannot show/ display picture on the screen On Fri, Jun 10, 2011 at 10:50 AM, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10 June 2011 15:47, joanne ta <joanne0558-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > and i have other question.. > > If you have another question, please start another thread. > > > when i take the image file (BLOD).. i cannot > > display it .. do you have any idea... > > Please give me some advice.. thanks ....\ > > How do you ''take it''? What code are you using to display it, and what > errors do you get? > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- -------------------------------- Thank you, Yen -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.