Forum: Ruby on Rails Model from DB generator

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Florian Hanke (Guest)
on 2005-12-28 20:10
(Received via mailing list)
Hello all,

Does a generator exist to generate the ActiveRecord model from the
database?
I wouldn't mind if it generated parent-child relations always as
has_many - belongs_to.

The scenario in my case is a database of about 180 legacy tables,
with a pattern that the foreign keys use (<parent table name>_OID).
These I'd like to wrap in the model as easily as possible without
having to type it in all myself, lazy bum that I am *g*

Cheers and thanks in advance for any hints and pointers,
    Florian
Ed W. (Guest)
on 2005-12-29 02:37
(Received via mailing list)
> Cheers and thanks in advance for any hints and pointers,
In situations like this I have often used a spreadsheet to "write" the
code.  Just use some complicated function to concat a bunch of
repetative strings together inserting the name of the table where
necessary.  Voila instant results.  Similar results are possible using
SQL and of course some ruby/perl scripting

Ed W
This topic is locked and can not be replied to.