Ruby existing database

Hello all from Ruby newbie,

I'm sure this has been asked many times, but I can't find the answer.

I would like to use Ruby for an existing database.

It does not use id for the primary key, and the table name are not plural.

The tables are already loaded and filled with data.

How can I get CRUD modules for the existing tables without changing the database structure in any way?

Hello all from Ruby newbie,

I'm sure this has been asked many times, but I can't find the answer.

I would like to use Ruby for an existing database.

It does not use id for the primary key, and the table name are not plural.

The tables are already loaded and filled with data.

How can I get CRUD modules for the existing tables without changing the database structure in any way?

Will Raffaele wrote:

Hello all from Ruby newbie,

I'm sure this has been asked many times, but I can't find the answer.

I would like to use Ruby for an existing database.

It does not use id for the primary key, and the table name are not plural.

The tables are already loaded and filled with data.

How can I get CRUD modules for the existing tables without changing the database structure in any way?

That depends. Are you using Rails? You specified Ruby without mentioning any other libraries...

Best,

Yes, I have installed Rails, as well as oracle_enhanced adapter and oci8 installed.

I found an interesting link about using legacy databases:

  Rails and Legacy Databases - RailsConf 2009

I did: rails --database=oracle ora_t1

I took the advice of Craig White and set the primary key and sequence as suggested in ctkagency.rb

ruby script\generate scaffold CTK_AGENCY AGENCY_SEQUENCE:number AGENCY_NAME:text

I got to the localhost/3000 page ok, showing:

About your application’s environment   Ruby version 1.8.6 (i386-mswin32)   RubyGems version 1.3.6   Rack version 1.0   Rails version 2.3.5   Active Record version 2.3.5   Active Resource version 2.3.5   Action Mailer version 2.3.5   Active Support version 2.3.5   Application root C:/Ruby/rails_apps/ora_t1   Environment development   Database adapter oracle_enhanced   Database schema version 0

The next page bombed.

I think it's because my table names have underscores, like "CTK_AGENCY".

Processing Rails::InfoController#properties (for 127.0.0.1 at 2010-04-21 14:49:21) [GET]    [4;36;1mSQL (328.0ms) [0m [0;1mselect decode(table_name,upper(table_name),lower(table_name),table_name) name from all_tables where owner = sys_context('userenv','session_user') [0m Completed in 421ms (View: 0, DB: 328) | 200 OK [http://localhost/rails/info/properties\] /!\ FAILSAFE /!\ Wed Apr 21 14:49:33 -0400 2010   Status: 500 Internal Server Error   Expected C:/Ruby/rails_apps/ora_t1/app/helpers/ctkagen_cies_helper.rb to define CtkagenCiesHelper     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:426:in `load_missing_constant'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize'     C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:137:in `helper'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in `each'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in `helper'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:120:in `helper'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in `each'     C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/helpers.rb:115:in `helper'     C:/Ruby/rails_apps/ora_t1/app/controllers/application_controller.rb:5