AR many-many join tables - can they have created_on, updated


#1

Hello all,

I’m creating a many-many join table between ‘homes’ and ‘users’. Can it
contain created_on? will AR update created_on, updated_on on this
table?

CREATE homes_users (
home_id int not null,
user_id int not null,
created_on datetime null,
updated_on datetime null
)

Thanks for your advice!


#2

I don’t think so. It’s the table’s associated class/object that does
it and a habtm table doesn’t have a class. Use a has_many :through.
That’ll do it.
-N