views:

21

answers:

0

Possible Duplicate:
Rails 3, belongs_to, has one? For 3 models, Users, Instances, Books

I have a book table (id, name, user_id, instance_id) both user_id and instance_id are foriegn keys. user_id belongs to instance_id.

When a new book is created I need both user_id and instance_id assigned.

Is that way to do that, in the model, note.rb, have a :

belongs_to :user, :foreign_key => :instance_id and user_id?

something like that?