You should use a has_and_belongs_to_many association.
Here is a nice code sample:
http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association

Don,t forget to create a middle table "bookmasks_lists".

If the asociation has any attributes you shold use  "has_many :through
association" instead.
http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association


2014-03-10 15:02 GMT-03:00 Giri <giridharanbt...@gmail.com>:

> Hey guys,
>
> I have a *Bookmark* model.
>
> I would like to have a *List *model. So my users can create Bookmark
> lists.
>
> I created a List scaffold with this command
>
> rails generate scaffold List title:string
>
>
> 1) A List can have many bookmarks
> 2) A Bookmark can have many lists.
>
> Can someone help me to create List Bookmark relationship.? It would be
> awesome if you can give me some resources to learn.
>
> Thankyou
>
> --
> 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/f63736b5-fe7c-44f4-9127-401bbc8039d4%40googlegroups.com<https://groups.google.com/d/msgid/rubyonrails-talk/f63736b5-fe7c-44f4-9127-401bbc8039d4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKj7%3DuT%2BQ%2BrCfzKjmP_gM6WZXPW9gcDP3yMGdQ8OPKQPCseOoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to