Legacy join table with extra attributes and Rails 2.0

RoRdeveloper
Sat, 16 Aug 2008 01:06:12 -0000

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.
Please excuse
me in case this is not the right forum for discussing this matter.

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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---