Still not sure of the basic problem, but it's not that tough to coerce legacy databases to conform to the Rails way.
For example, I deal with legacy data. In Rails the main reference key is assumed to be an integer auto incremented field in the database called 'id' . My legacy database has a table with a primary key that is a text field of a different name, so to make it conform, I have to do this:
in my database.yml:
That establishes a basic connection to my legacy MS SQLServer database. Now I define an active record model that uses that connection:
class Aim < ActiveRecord::Base
Now I define a model based on the legacy connection
class Broker < Aim
So now I have a model Broker, but instead of looking for a database table called 'brokers', it looks for a database table called 'Producer', I've overridden the rails default. Then I tell Rails that the primary key is NOT 'id', but a field called 'ProcuderID'. So for example, when I do:
@broker = Broker.find(params[:id])
It just works, even though params[:id] contains a string and not an integer value.
Am I understanding your dilemma?
Last edited by BradHodges (2011-12-06 01:00:00)
Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.