SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    confused about relationships

    How would I express the following with relationships:
    I have an "articles" table, an "authors" table, a "collections" table, and an "articles_collections" table.
    An "article" has a reference to an "author_id".

    Here is what I have, but not sure it's correct:

    PHP Code:
      class Collection ActiveRecord::Base
              has_and_belongs_to_many 
    :articles
      
      
    class Author ActiveRecord::Base
          has_many 
    :articles
      
      
    class Article ActiveRecord::Base
          belongs_to 
    :author
          has_and_belongs_to_many 
    :collections 
    Thanks for any help or suggestions.
    Last edited by MikeShank; Jul 1, 2006 at 19:57.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •