2009/9/22 Eduardo Bueno
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:>
> Hello people,
>
> I am starting to build an application in Rails using SQLServer. In fact,
> I''m rebuilding it from Java EE to Rails.
>
> I created a new project and managed to connect to the database using
> ODBC, so I ran a rake db:migrate. Everything worked fine: the database
> schema was copied to my schema.rb file.
> Here comes my problem: is there a command that creates ruby classes from
> the database? If not, should I use scaffolding to create my classes or
> create them manually? I''m pretty afraid of deleting content
> unintentionally. Hope you can guide me, thanks.
When I wrote a Rails app for an existing db I used the scaffold
generator to build each model as if I was creating a new table, then
just deleted the migration file. This gave me the models and basic
REST access on which I built the app.
However you do it don''t develop with your production database
otherwise at some point you are bound to mess it up. Make a copy of
the db (or a subset) and use that for development. And of course you
will be writing tests as you go along which will access a test
database.
Colin