[Rails] Re: The need of IDs in ActiveRecord

Eric Anderson eric at afaik.us
Wed Jan 12 00:32:46 GMT 2005


Nicholas Wieland wrote:
> 2) Putting a constraint on the DB schema means that if I have an
> application written in another language I must adapt my correct and
> running DB to use Rails... if I have my website on LAMP (for example)
> and I want to use Rails for whatever reason, I can't just plug rails and
> develop my app, I have to modify my DB.
> 3) One of the best things of DBs is data independency, you can
> use the same DB for every application that relies on
> that data, an application should _never_ ask the DBA to adapt the schema
> to the platform, because data (DB schema) never changes, procedures on
> it always :)

It seems to me that this is the way Rails reduces the amount of code 
compared to the various ORM solutions that require mapping files. Since 
Rails assumes a certain data structure it can capitalize on that 
commonality and reduce the amount of code you have to write. If you want 
to support wildly varying database schemas then you end up resorting to 
various mapping methodologies and even custom data objects.

Obviously through options (such as :finder_sql, table name prefixes and 
suffixes and others) we can expand the number of different database 
designs Rails can support without much coding. But if a database design 
is too far out of the standard design Rails assumes, then ActiveRecord 
will not be able to do the ORM because it requires something more 
complex (and will require more code). Avoiding complexity and lots of 
code seems to be a design goal of ActiveRecord so something else will be 
a better tool.

Obviously this does create problems where multiple applications are 
using a database. You hope the database design is one Rails can grok, 
but if it is not then another ORM might be in order. The good news is 
that the design Rails supports is common and recommended. Therefore many 
databases conform with perhaps only a small amount of tweaking on either 
the code or database side.

Just my two cents,

Eric


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050111/79b404ac/signature-0001.bin


More information about the Rails mailing list