I am a fresh RoR developer and I am facing difficulty in getting a
legacy join table (with extra attributes) to work with Rails 2.0. I
wanted to apologize for the repeat post ( i accidentally pressed the
wrong keys previously)
My rails application works well with Rails 1.2.3. Following is the set-
up:
class Article
has_and_belongs_to_many :users
end
class User
has_and_belongs_to_many :articles
end
Legacy join table “articles_users” has the exepcted columns: (1)
article_id (2) user_id, and an extra third column say, (3) more_info
Following are my observations:
(1) In my application, I use “push_with_attributes” method to save
records to the legacy join table. My understanding is that support for
“push_with_attributes” in particular, and extra attrbutes in habtm
join tables, in general, is not present in Rails 2.0
(2) I tried to modify my application using the Rails recommended
approach of using “has_many :through” associations to realize join
table with extra attributes. However, in this case Rails 2.0 appears
to complain that the join table does not have a primary id column.
Is there a way to resolve this issue in Rails 2.0 framework without
having to change the database table? Please let me know if I am
missing something obvious.