Navigation, Organization, Tree Structure, etc...

14 views
Skip to first unread message

Banjoey

unread,
Sep 18, 2011, 10:16:44 PM9/18/11
to Hobo Users
Working on a new church site with hobo and am basically creating a
CMS. It will start out simple with "Posts" and "Episodes" as my two
main models. Episodes will be for podcasts and Posts will be page
contents that the church staff can create.

I'm wanting to make an easy to use way for them to create a new post,
and if it is a "page" post (I'll also have news posts, bulletin posts,
etc.) they select it's position in the site's navigation system.
They'll be able to add/remove levels of navigation as necessary. So,
I'll have several base "PostCategories" and then any number of child
categories. I want to integrate this in with some type of menu system
that will have nice animated drop downs, etc. (I assume I'll use
javascript/jquery stuff for this).

Unfortunately, I just found out through experimentation that
ActiveRecord doesn't like a model having has_many relationships
defined with itself... :) I'm wondering if there's a good way to do
this (or perhaps a better "hobo way" of doing something like this that
I don't know about). I was thinking of using the 'ancestry' gem to add
this functionality to my Post model, but don't know if that's the way
to go either.

Any suggestions out there? How do you handle menu's/navigation on your
site?

Thanks!
Joey

kevinpfromnm

unread,
Sep 18, 2011, 11:59:24 PM9/18/11
to hobo...@googlegroups.com
It's not as easy as standard models but you can do it.  You just need to specify the class/foreign key as it can't guess when you're not using standard relation names.

Banjoey

unread,
Sep 19, 2011, 8:01:03 AM9/19/11
to Hobo Users
Ah ha! I see where I was going wrong now...

I had the has_many :child_categories relationship set up (I was using
the class_name parameter on that one), and then I had a
belongs_to :parent_category set up also. I wasn't thinking that
getting to the parent was already possible, and once I removed the
belongs_to it migrated.

Thanks Kevin. Big help to me as I would've quit with this strategy and
gone with something else immediately.

Anyone else got suggestions for menu/navigation elements?
Reply all
Reply to author
Forward
0 new messages