I am working on my first real rails project and am looking for a little professional advice.

I am looking to have four tables in my MySQL database (User, Book, Comments, tags) and the following business rules apply.

A User may make one or many Comments for a Book, but a Comment can only belong to one Book.
A User may place one or many Tags against a book, but Tag can only belong to one Book.

Graphically, I cam up with the following: (ascii art will never die) 

```
+---------+             +---------+  
|         |             |         |
|         |             |         |
|  User   |1           1|  Book   |
|         |-----   -----|         |
+---------+     |  |    +---------+
     | 1        |  |          | 1
     |          |  |          |
     |          |  |          |              
     | 1,*      |  |          | 1,*
+---------+     |  | 1,*+---------+  
|         |     ---+----|         |
|         |1,*     |    |         |
| Comment |---------    |   Tag   |
|         |             |         |
+---------+             +---------+

```

I am looking for any recommendations on how to configure my models in Rails. At the moment I am looking to setup:

```
class Users
  has_many :tags
  has_many :comments
  has_many :tagsBooks, :through=>tags, :class_name => "tags_books"
  has_many :commentsBooks, :through=>comments, :class_name => "comments_books"
end

class Books
  has_many :tags
  has_many :comments
  has_many :tagsUsers, :through=>tags, :class_name => "tags_users"
  has_many :commentsUsers, :through=>comments, :class_name => "comments_users"
end

class Tags
  belongs_top :users
  belongs_to :books
end

class Comments
  belongs_top :users
  belongs_to :books
end

```

I 'believe' this will assist in enforcing foreign key fields (User\_id and Books\_id) in the Tags and Comments tables - which is ultimately what I need to do. And I am hoping this will allow me to associate tags and comments to either/both Users and Books ie books.tags or users.tags.

Is this correct?

I am happy to completely change the design as long as foreign keys are enforced in the db and rails.

Cheers,

Damo