Rails and SQL

I work at a company that mainly does Java and PHP, as well as some
old TCL. Alot of the code has these really big complex SQL queries
where there is a select off of several tables and there is some nested
inner select. It has occured to me in my advocacy of Rails that if I
ever convinced them to take Rails more seriously and look into it that
they might have some problem with the approach where in Rails you
often don't write those kinds of queries. Has anyone encountered that
kind of criticism ?

I am not really much of an SQL expert myself, though at times I have
had to work with some of these queries, I've only been at this company
for a year. I know you can do straight SQL in Ruby, but typically in
Rails with active record, you wouldn't do these kinds of complex
queries. I feel quite content myself to steer away from that kind of
thing if I can, but I'm not sure how to make a case of it with people
who might have a problem with it. I also get skeptical sometimes if I
can ever convince anyone of anything, so sometimes I never really
worry how to present a really complete argument anyway ..

This is a valid concern on behalf of management, but really it's just
making them look at things differently. Most of my apps end up with
everything coded AR style to begin with, except in the case of AR just
not being able to create the object that I want. (Yes it does happen I
have a 30 line sql statement in one app, that I don't even want to
consider trying to write with AR). Mostly I find myself refactoring
some of Rails ORM layer into sql in order to remove bottlenecks, but
this is towards the end of a project. The thing is ORM has saved me so
much time during development that I can afford to spend a day or two
re-factoring some of the complex finds or strange inserts that AR
might do into straight up sql.
At the end of the day all that Rails is doing is implementing an ORM
layer (Object Relational Mapping) just like Java does with Hibernate
and even PHP does with CakePHP framework. Personally I'd just look at
selling ORM to them if that is their concern with rails.
There is a great screen cast from the Rails envy guys about Active
Record ( not ActiveRecord, note the space ), it might be worth looking
at before tackling management. http://www.railsenvy.com/2007/8/8/activerecord-tutorial

Good luck,
Cam

Thanks,

I have the active record book that came out. I have almost all of the
major Rails and Ruby books in existence. I've done a bunch of fairly
small websites on my own in Rails. I think I sort of realize myself
why I like AR, I just am not that great of a salesman in some way
perhaps.