Generate SQL-Statement from Model.save()

Hello!

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
salutation,…)).

I tried it with:

x=0
while x < 300
q = mail.new(params…)
q.save()
end

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?

thanks!

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

http://www.ruby-forum.com/topic/136898

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.

Peace,
Phillip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs