comments inline

On Fri, Jun 5, 2009 at 1:57 PM, Hirak <[email protected]> wrote:

>
> Hi All,
>         I am a newbie in rails. I am creating a new rails
> application. Here I have 4 models.
>
> 1. User
> 2. Item
> 3. Application
> 4. Tag

ok

>
>
> The concept is
>
> - Item belongs to User
> - Item has many Tags


It means you have tags table will have item_id

- Item has many applications through tags


for above you must have some relations between application and tags table.

- Tags are hierarchical (i.e a tree structure, a child tag can be
> related to a parent tag.)


tag belongs_to parent_tag :class_name => "Tag", :foreign_key => "parent_id"

You must have parent_id field in tags table.
If parent_tag is nil then you can identify tag as child_tag

>
>
>
> Please help me, how to handle these Associations.
>
> Thanks
> Hirak
>

hope this will help !

-Sandip R~


> >
>
-- 
Ruby on Rails Developer
http://sandip.sosblog.com
http://funonrails.wordpress.com
www.joshsoftware.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