Displaying 1 result from an estimated 1 matches for "books_to_review".
2006 Jun 13
0
question about saving associations when using has_many :through
...d_books, :class_name => "Book", :dependent => :delete_all
# each user has a list of books that they are required to review
has_many :book_reviews, :dependent => true
# this :through association allows us to retrieve the books the user
# is required to review
has_many :books_to_review, :through => :book_reviews, :source => :book
end
Now, when a user submits a book, I must assign the book to be reviewed
by 5 different users. I''ve created an after_save callback in book.rb
which does the following:
users.each do |user|
user.books_to_review << self...