I have been trying to solve this problem all day but haven’t got any solution, so could you please help me?
Here is the problem description:
The Program should be able to display the bread crumb trail for a given
Category/SubCategory.
Ex:
Input : Public Relations
Output : Business & Finance >> Advertising & Marketing >> Public Relations.
Here Business & Finance is the primary category, Advertising & Marketing is its sub category and public relations is sub category of Adv & marketing.
I thought about implementing it using recursion, but i am not quite sure how to do it.
Thanks,
Jimmy
Assuming it is plain Ruby you could do something like this:
and use it like so