Legacy join table with extra attributes and Rails 2.0 (please ignore previous post with this subjec

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-

class Article
has_and_belongs_to_many :users

class User
has_and_belongs_to_many :articles

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.

Well i believe using habtm you couldn’t access that more_info column
anyway. There’s not other way except modifying table and adding
primary key.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs