Rails: How to observe union records that don't actually have a model?

Is it possible, using Observer, to observe the creation of JOIN records? For example, you have a user model that has_and_table_to_machine book models. Is it possible to track books_users records as they are created or deleted, or do I have a BookUser model for this?

An example of what I want to observe:

User.books << book

OR

User.books.push(book)

OR anything!

Thanks,

Dave K.

+5
source share
1 answer

, has_many: , has_and_belongs_to; BookUser, / activerecord (, after_save). , http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off

+4

All Articles