Peter Meier wrote:
>>> Are we not using the rails validation methods on purpose ?
>>> e.g.
>>> validate_uniqueness_of :name
>>> will ensure that no two (hosts, parameters etc) will be created.
>>>
>>> This ofcourse generates another select statement each time (to verify if 
>>> it already exists)...
>> That sounds like something that should be enforced by the database
>> schema, not by the application.
> 
> I was told in rails projects that it should be done rather on the rails
> side as rails gives you better error handling than the exception raised
> from the database backend.
> Rails side gives you also more fine grained controller over validations
> etc., still it is a good practice to put such things as well into the db
> schema, but the essential parts should be done in rails.
> 
> I'm open to hear reasons why it should be done rather the other way round.


Of course, the point of using an ORM in the first place is to specify 
the constraints on the model, not on the underlying DMBS. This is the 
same argument as why you'd rather use a DBMS instead of writing the 
physical storage layer yourself.

BUT this doesn't mean that the ORM is not allowed to propagate 
constraints from the model into the DBMS if it would help avoiding to 
DOUBLE (  o_O  ) the numer of database roundtrips in the common case. As 
Thomas already noted, there *ARE* ways to implement this AND be race-free.


Which only goes to show that glitz and time to market always trump 
technical superiority. Just put it into vendor!


Regards, DavidS

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.


Reply via email to