class Book < ActiveRecord::Base
has_and_belongs_to_many :categories
has_and_belongs_to_many :users
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :books
end
class User < ActiveRecord::Base
has_and_belongs_to_many :books
end
Above is how I declared the relationships between my models. In my book controller and form, I can easily create a book and associate that book with a category. But how do I associate that book with a user on creation time? Is there a part of rails automagic that will supposedly handle this for me or would I have to do some transactional type to update the join table to associate a book with a user.