# Rails + SQLServer

**URL:** <https://www.ruby-forum.com/t/rails-sqlserver/175902>\
**Category:** Rails\
**Created:** [September 22, 2009, 4:02pm UTC](https://www.ruby-forum.com/t/rails-sqlserver/175902 "2009-09-22T16:02:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michbukana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@michbukana](https://www.ruby-forum.com/u/michbukana)\
**Post date:** [September 22, 2009, 4:02pm UTC](https://www.ruby-forum.com/t/rails-sqlserver/175902/1 "2009-09-22T16:02:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![michbukana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@michbukana](https://www.ruby-forum.com/u/michbukana)\
**Post date:** [September 22, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/rails-sqlserver/175902/2 "2009-09-22T16:43:15Z")

</div>

2009/9/22 Eduardo B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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
