That code was the for the view, hence the HTML tags. You'd obviously
just use the iterating code without the output in the controller.

On Aug 26, 3:30 pm, Zack Nathan <[email protected]> wrote:
> CU wrote:
> > Just an example of how you'd output it in a view, I'm sure you can
> > adapt it from there to extract whatever values you want:
>
> > <% @parsed_response[0]['searchresults']['category'].each do |cat| %>
> >   <h1><%=h cat['name']%></h1>
> >   <p>
> >     <h3>Foods</h3>
> >     <% cat['foods']['food'].each do |food| %>
> >       <p><%=h food['id']%> - <%=h food['display']%></p>
> >     <% end %>
> >   </p>
> > <% end %>
>
> thanks, but when i do this in the controller i get this error:
>
> You have a nil object when you didn't expect it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.[]
>
> But if i pp @parsed_response its not nill!
>
> thanks
> --
> Posted viahttp://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 [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