Importing existing Oracle DB to Ruby

We are moving ColdFusion applications to Ruby on Rails and we would like to keep our existing data. Is there a way to import the Oracle schema into Ruby using one of the commands?

Thanks!

What do you mean by ‘import into Ruby’? ActiveRecord (the database library of Rails) is capable of communicating with Oracle databases.

Jason

I'm not sure what you're asking. The schema isn't "in" ruby. You can access it without any change at all to the database if you like. Might require some tweaking to your ActiveRecord models if the schema is not using AR's naming conventions (which would be a miracle if it were.)

*OR*, you can port it to what ActiveRecord expects with its defaults, which will make ongoing development quite a bit easier.

Let me clarify,

I suppose I'm looking for is a tutorial or a way to have a Ruby app created based on an existing schema. I'm a newbie so I'm not sure if I mean a scaffold. The examples I've found so far let me create new databases which work fine. Sorry for the confusion.

Thanks

Michael Campbell wrote:

Hi !

I suppose I'm looking for is a tutorial or a way to have a Ruby app created based on an existing schema. I'm a newbie so I'm not sure if I mean a scaffold. The examples I've found so far let me create new databases which work fine. Sorry for the confusion.

Hmmm, I'd say that the scaffolding is what you want, to at least see if you can access your existing data.

Start with a fresh Rails application. Setup config/database.yml correctly. Then, use the console to confirm you can communicate with the database:

$ script/console

ActiveRecord::Base.connection.execute("SHOW TABLES")

If you get an error, your connection parameters are incorrect.

Then, you can start building your scaffold:

$ script/generate scaffold User

Hope that helps ! François Beausoleil