I finally managed to debug more around the @stories variable. This is
an outtake from it (rdb:14) display @stories
1: @stories =
(rdb:14) show @stories
Unknown show command @stories
(rdb:14) p @stories
nil
(rdb:14) pp stories
NameError Exception: undefined local variable or method `stories' for
#<NewsController:0x102ece778>
(rdb:14)
So my conclusion is from this segment of code: apiKey = ("http://
www.mysomething.com/partner/api/1_0/randomnumber/channel/290/material/list/")
    doc = Nokogiri::XML(open(apiKey).read) <-- here I have the xml
response and all is dandy
but the next line I do this:
@stories = doc.css(".item").map do |n| <--here its empty.
      h = {}
      %w(header source_name summary url geo created_at
type_of_media).each do |key|
        h[key.to_sym] = n.css(key).text
      end
      News.new(h)
    end

How is this possible? I might be new to ruby and rails but Im feeling
really lost. Any good feedback?!
Thanks!

On 15 Jan, 16:07, Colin Law <[email protected]> wrote:
> On 15 January 2011 13:39, Tim <[email protected]> wrote:
>
> >> So what did you learn from debugging it?
>
> >> Colin
>
> > Well Colin Im a bit confused. I had some problems with installing the
> > ruby-debug as Im using Rails 3. So finally I gave up with that.
>
> Persevere.  Rails 3 should be no problem.  Did you follow the guide 
> here:http://guides.rubyonrails.org/debugging_rails_applications.html#debug...
> If so what problem did you have?  You need to be able to break into
> code and inspect data and run code snippets to see what is wrong.
> Even if you sort out your current issue there will be another that
> needs the debugger.
>
> Colin
>
>
>
> >  But
> > when I did puts doc.to_s I get the xml in my console so I have it
> > there. But the line after where I do this: @news = doc.css('news').map
> > do |n|
> > I tried to do @news.to_s and that gave me nothing. Also I did raise
> > @news.to_yaml which just game me an error. Do u have any clues on
> > that?!
>
> > Regards!
>
> > --
> > 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 
> > athttp://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.

Reply via email to