Hassan Schroeder <hassan.schroeder@...> writes: > > On Mon, Jul 4, 2011 at 7:17 PM, Scott Ribe <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 w/ > write privileges, so I'm fully empowered to shoot myself in the foot > if I choose > > And yes, sometimes in dev mode I'll dump the DB, test drive an idea > in raw SQL, restore, rewrite that idea as a migration or rake task and > test, restore, etc. > > But that's not the same as having a non-Rails app without validation > constraints accessing the same DB (which I believe was Andrew's > point - apologies if I'm misinterpreting). >
I seem to have started a religious war. Of course there are many environments in which is may be necessary (even desirable) for direct access to the database to be granted to clean data, perform transformations, or fix issues. Indeed, there are also many cases where Rails is access an existing system, or utilising a database common to many applications. If you are in on eof these environments, then DB level validations are probably a good idea since Rails expects the database to be structured in a certain fashion. Other applicaitons may mess this up and cause your Rails app to exhibit weird behaviour, or stop working altogether. Hell, even within Rails you can deliberately bypass model validations. At the end of the day, be mindful of how your app will behave if you suddenly can't save/update a record because the database is enforcing validations without Rails knowing about it. I have been through this pain and now encourage other's scripts to access services using REST - at least then I can perform Ruby magic on the way in or out of the DB. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.

