BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

InfoQ Article: DrySQL ORM for Rails

| by Obie Fernandez on Dec 14, 2006. Estimated reading time: less than one minute |

Bryan Evans of the DrySQL project felt that ActiveRecord falls a bit short of complying with the DRY principle. If you have tables or columns that aren't compatible with the naming conventions, then you need to redefine some of your database artifacts in application code. As well, ActiveRecord associations and validations are redundant specifications of database constraints. Bryan wants to be able to change his database schema without needing to re-wire the ORM layer(s) of dependent applications. He wants to avoid (as much as possible) the situation where he's averse to making a change to his database schema because of the effort that would be required to sync up dependent applications.

Since ActiveRecord uses the database's information schema to dynamically retrieve column metadata, Bryan asked: "Can this strategy be applied to all database artifacts?"

Read ORM with DrySQL and ActiveRecord

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Clarification by Bryan Evans

I should have been more careful in my description of validates_nullability_of. To clarify, this validation always rejects a null value, but the validation is only generated by DrySQL in situations where the DB would reject a null.

Re: Clarification by Sam Smoot

It might be interesting to see this work contrasted with Dr. Nic's "Magic Models" (magicmodels.rubyforge.org/).

I haven't used either, but they seem to share some goals, so maybe a collaborative effort would be beneficial?

Typos in code snippet #1 by Tyler Rick

This code snippet has the line:

Employee bryan = Employees.find(18)

1. The 'Employee' before bryan is unneeded and incorrect. (Might be correct in a *statically* typed language like Java where you actually have to declare variables... :) )

2. Model names are singular: Employee.find(18)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date with curated articles from top InfoQ editors

"You dont know what you dont know" change that by browsing what our editors pick for you.

BT