I have a loop for parsing each rss feed @address.each do |address| @feed = SimpleRSS.parse open(address.feed) end the problem is my my instance variable @feed just gets overwritten so basically it displays the last parsed feed how can i store each feed without it been overwrited so i can display it in my view? regards nick -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have a loop for parsing each rss feed > > @address.each do |address| > @feed = SimpleRSS.parse open(address.feed) > end > > the problem is my my instance variable @feed just gets overwritten so > basically it displays the last parsed feed > > > how can i store each feed without it been overwrited so i can display it > in my view? > > regards > > nick@feeds = [] @address.each do |address| @feeds << SimpleRSS.parse open(address.feed) end In your view @feeds.each do |fee| ... end Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrew Timberlake wrote:> On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> how can i store each feed without it been overwrited so i can display it >> in my view? >> >> regards >> >> nick > > @feeds = [] > @address.each do |address| > @feeds << SimpleRSS.parse open(address.feed) > end > > In your view > @feeds.each do |fee| > ... > end > > Andrew Timberlake > http://ramblingsonrails.com > http://www.linkedin.com/in/andrewtimberlake > > "I have never let my schooling interfere with my education" - Mark TwainHi thanks for quick reply, i tried using << symbol before and it just gave me a syntax error indicating theres somethings wrong around parse. open -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i just tried this with the built in rails rss parser and seems to work fine. must be an issue with simple rss im guessing. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 14, 2009, at 10:55 AM, Andrew Timberlake wrote:> On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> I have a loop for parsing each rss feed >> >> @address.each do |address| >> @feed = SimpleRSS.parse open(address.feed) >> end >> >> the problem is my my instance variable @feed just gets overwritten so >> basically it displays the last parsed feed >> >> >> how can i store each feed without it been overwrited so i can >> display it >> in my view? >> >> regards >> >> nick > > @feeds = [] > @address.each do |address| > @feeds << SimpleRSS.parse open(address.feed) > endOr more simply: @feeds = @address.map {|address| SimpleRSS.parse(open(address.feed)) }> > > In your view > @feeds.each do |fee| > ... > end > > Andrew Timberlake > http://ramblingsonrails.com > http://www.linkedin.com/in/andrewtimberlake > > "I have never let my schooling interfere with my education" - Mark > Twain-Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---