Tables/field names in rails

Is anyone aware of something which would MAP the table & field names
that
someone might presently use in a db schema, to the rails requirements?
For
example, if I have a table called associate, and a table called users,
and
within associates, I have a field called userskey which contains the id
in
users, I would like to be able to map what these table and field names
ARE
to what they SHOULD be to comport with the rails naming conventions
(i.e.
the tables should be associates, users and the field in question should
be
users_id).

Is anyone aware of such a mapping mechanism? It seems this is a mature
enough web platform that such a mechanism must exist (in which case, the
Struts and JSF holdouts would HAVE to come along!)

Thanks, Ike

I think this is a question for the Rails mailing list.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Ike wrote:

Is anyone aware of something which would MAP the table & field names that
someone might presently use in a db schema, to the rails requirements?

Random googlage shows http://the.rubydevelopers.net/node/25.

If you have control over the database, you could also go the other way
around: create a separate schema called, lessay, “rails”, consisting of
only views that would alias the original names to the Rails-friendly
ones.

This, of course, presumes that the database can do that.

David V.

On Mon, Oct 16, 2006, Ike wrote:

Is anyone aware of something which would MAP the table & field names that
someone might presently use in a db schema, to the rails requirements? For
example, if I have a table called associate, and a table called users, and
within associates, I have a field called userskey which contains the id in
users, I would like to be able to map what these table and field names ARE
to what they SHOULD be to comport with the rails naming conventions (i.e.
the tables should be associates, users and the field in question should be
users_id).

ActiveRecord is very flexible, it just supposes “sensible” defaults.
You can easily use it with legacy schema that don’t fit the naming
scheme.

See, for example, ActiveRecord::Base#set_table_name, #set_primary_key,
and friends.

Ben