Rails with existing RDBMS schema


#1

Hi,

I’m seriously considering using Rails to develop several internal
corporate web apps that will need to interact with well-established
database systems (3 systems running SQL Server, Oracle, and PostgreSQL).
The schema on these systems are basically set in stone. Can a Rails
application interact with an existing schema without serious Rails
modification? From what I’ve read about Rails, it expects the schema to
have certain names, entries, and structure.

Has someone developed with Rails in a similar situation? How did it go
for you?

Thanks,
David


#2

Hi David,

You should be able to use Rails without modifying the Rails code itself.
Most likely you’ll need to do some extra configuration in your
application’s
models. This should help:
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.ht
ml

You would also probably use the set_table_name macro here:
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M000880

Daniel


#3

David M. <david.mattes@…> writes:

I’m seriously considering using Rails to develop several internal
corporate web apps that will need to interact with well-established
database systems (3 systems running SQL Server

Works fine, I am doing exact that as we speak, mostly with SQL-server.
You can
override the primary key name etc. Of course more you configure, more
you lose
the “convention over configuration” advantages of Rails.


#4

http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas. There

from what i can tell, this is great for a place that is soo stodgy they
dont want to ever move to a new schema, or theres too much other legacy
stuff relying on it…

is there an easy way to cast from one class to another? for example, i
have a bunch of old data, and id like to make a OldThing and Thing
class, they would be identical except OldThing would be decorated with
all the custom SQL, and once the object is read, id like to write it out
in the shiny new schema format…


#5

Yes. I am also building an internal app that interacts with an existing
database system. It works fine. Check out
http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas. There
isn’t much you need to change in Rails, just more settings to point away
from the default settings that’s all.

David M. wrote:

Has someone developed with Rails in a similar situation? How did it go
for you?

Thanks,
David


Sau S.


http://read.saush.com
http://jaccal.sourceforge.net