Legacy database and habtm

Greetings,

I’m fighting with a poorly designed SQL Server database. The database
is not normalized whatsoever, so I’m running into some brick walls
trying to get Rails to be friendly with it.

I need to create a habtm relationship between a User table I created
and a Depletion model I created. Depletion points to a view in the
database called “Dep” that has no primary key. It has a varchar-based
column called “VendorNumber” that I want to use to populate Depletion
side of the relationship. In the end, the user should be able to
view the records for many Depletion vendors.

Is there a way to manually populate the join table to store the user
id and the string-based vendornumber and still use some of the
niceties afforded by the habtm relationship?

Thanks.

This is still an issue to me. Does anyone have any ideas or
suggestions?

Thank!

  • j