I have the following relationships setup:
class Article < ActiveRecord::Base
has_and_belongs_to_many :authors
end
class Author < ActiveRecord::Base
has_and_belongs_to_many :articles
end
I noticed that, although the join table articles_authors has timestamps, they do not populate when creating a new relationship. For example:
Author.first.articles << Article.first
It’s important that I keep track of when an author is associated with an article.
Is there a way that I can do this?
From the rails guides.
If it still doesn’t work with that structure, then instead of using an array push, use a create.