Generate SQL-Statement from


Im a rails newbie, i like rails very much, but now I have a problem:

I want to generate in one action about 3000 sql statements
(mailtemplate that becomes generateted to a mail (with personal

I tried it with:

while x < 300
q =…)

but thats muuuuch toooo slow… Is there a chance to get the
generated sql statement back and execute it afterwards with only one
sql-execution statement?


On Jan 19, 2008, at 8:47 AM, Lp wrote:

While it’s not exactly the same as you are looking to do, there was a
discussion of something similar in this thread

If you have the patience to get to the end (and it’s really not that
long), there is an example of extending ActiveRecord to support
return the generated SQL. It probably wouldn’t be too hard to do
what you are looking to do.