[Rails] Re: when to add validations to database

2011-07-07 Thread Rudi
Actually, we really do some validation in database layer. Our RoR software manage huge tables, and add some stuffs like unique indexes and foreign keys really helps to improve performance. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. T

[Rails] Re: when to add validations to database

2011-07-05 Thread Milan Dobrota
Pretty much any custom validation querying the database is a suspect. Milan Dobrota rubylove.info -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/

[Rails] Re: when to add validations to database

2011-07-04 Thread Andrew Skegg
Hassan Schroeder writes: > > On Mon, Jul 4, 2011 at 7:17 PM, Scott Ribe wrote: > > > Really? ***ALL*** access through RoR and the models? ***NEVER*** any direct access for maintenance? Not ever??? > > That wasn't the stated premise -- do I "fully control access to the > underlying database"?

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Fred Ballard
Good point. I was only talking about ad hoc access not regular access from outside of Rails. That doesn't seem possible -- or at least shouldn't be. Fred On Mon, Jul 4, 2011 at 21:41, Fred Ballard wrote: > In a large scale environment, there may be times when someone accesses the > database di

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Fred Ballard
In a large scale environment, there may be times when someone accesses the database directly, bypassing Rails. This may include the DBAs, for instance, or even the maintainers of the system. This may happen in trying to resolve a production problem in as short a time as possible, and it seems lik

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Hassan Schroeder
On Mon, Jul 4, 2011 at 7:17 PM, Scott Ribe wrote: > Really? ***ALL*** access through RoR and the models? ***NEVER*** any direct > access for maintenance? Not ever??? That wasn't the stated premise -- do I "fully control access to the underlying database"? Yes. I am the only one accessing the DB

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Scott Ribe
On Jul 4, 2011, at 6:47 PM, Hassan Schroeder wrote: > I was going to say "most", but actually -- I don't currently maintain > *any* applications where that isn't the case. Obviously YMMV. Really? ***ALL*** access through RoR and the models? ***NEVER*** any direct access for maintenance? Not eve

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread John Feminella
> Models are the gatekeepers to your database.  So long as you are in an > environment where you fully control access to the underlying database, there > should be no need to add any database validations (although I know a few DB > administrators who choke on such ideas). I don't think this is tru

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Hassan Schroeder
On Mon, Jul 4, 2011 at 5:04 PM, Scott Ribe wrote: >> So long as you are in an >> environment where you fully control access to the underlying database... > > And where does one find such an environment in the real world??? I was going to say "most", but actually -- I don't currently maintain *a

Re: [Rails] Re: when to add validations to database

2011-07-04 Thread Scott Ribe
On Jul 4, 2011, at 5:24 PM, Andrew Skegg wrote: > So long as you are in an > environment where you fully control access to the underlying database... And where does one find such an environment in the real world??? -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 72

[Rails] Re: when to add validations to database

2011-07-04 Thread Andrew Skegg
Adrian Caceres writes: > > Normally all my validation is done in my models. > > Michael Hart in his rails tutorial explains why the uniqueness > validation should also be done at the database layer ( > http://ruby.railstutorial.org/chapters/modeling-and-viewing-users- one#sec:the_caveat). >