On 23 November 2015 at 21:35, fugee ohu <fugee...@gmail.com> wrote:
> where in the tutorial is the discussion of this

You have not told us what your fundamental problem is, so it is
difficult to say.  You have just said you want to display all the
categories so something like

Category.all.each do |category|
  # show data for category
end

However since I am telepathic I am guessing that what you actually
want to do is show the categories for each parent, which sounds pretty
much like user/micropost relationship in the tutorial.  The clue here
is in the words "each parent".  Don't start with the categories and
try to group them with the parents, start with the parents and work
down, so maybe

Parent.each do |parent|
  # show parent data
  parent.categories.each do |category|
    # show category data
  end
end

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtNdNFK7KP%3Dx8k2%3DP2srHMMzKLNSQMxmmYLzqAeAn34HA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to