ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
[Rails] Scaffolding an existing Oracle DB
by Kevin Williams other posts by this author
Feb 28 2005 9:40PM messages near this date
[Rails] Scaffolding an existing Oracle DB | [Rails] Scaffolding an existing Oracle DB
I spent a few minutes looking into this a bit deeper.

It appears that the current Oracle adapter cannot handle schema names. 
It also seems the SQL Server adapter can't either, but I haven't tried 
it. The PostgreSQL adapter appears to handle it. The problem is that if 
you assign the table_name to be '<schema> .<table>' the adapter cannot 
query table metadata from the system tables by using the table name 
alone. The PostgreSQL adapter has the 'split_table_schema' method to 
handle when to use the schema and when to use the table name alone.

I'm likely wrong, but after 5 minutes of browsing the code this is how 
it looks to me.

On the suggestion of creating "ActiveRecord-friendly" views, that should 
work but I have no control over the database whatsoever. :(

Kevin



Tim Lucas wrote:
>  On 26/02/2005, at 2:31 AM, Kevin Williams wrote:
>  
> > I wonder if anyone else has tackled this problem already. I have an 
> > existing database that I want to Rails-enable. The "five minute magic" 
> > window has come and gone, and I still can't get it to work. All the 
> > scaffolded views don't show any fields at all, just the "Show", 
> > "Edit", and "Destroy" methods.
>  
>  
>  Anything in the error logs?
>  
> > :snip
> >
> > I suspect that the naming scheme in the database is not 
> > ActiveRecord-friendly. Does anyone know how I could get the model to 
> > be scaffolded easily?
>  
>  
>  Create some views against the current tables that follow the AR 
>  conventions.
>  
>  See Neville Burnell's post, as hes sucessfully done this using SQL Server:
>  http://article.gmane.org/gmane.comp.lang.ruby.rails/3374
>  
> > Does anyone know a better way to handle the schema prefix? I suspect 
> > the answer might be RTFM, but I haven't gotten through much of it yet.
>  
>  
>  Not sure if there's a param you can pass to the oracle adaptor in the 
>  config file to specify the schema prefix for all tables. You may have to 
>  override table_name in each AR class.
>  
>  - tim lucas
>  
>  http://www.toolmantim.com
>  
>  _______________________________________________
>  Rails mailing list
>  Rails@[...].org
>  http://lists.rubyonrails.org/mailman/listinfo/rails

----------
Scanned for viruses by ClamAV
Thread:
Kevin Williams
Tim Lucas
Kevin Williams
Corey Lawson

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved