SecurityError, and how to set ruby $SAFE safe level ?

I got some error message when find_by_sql

SecurityError (Insecure: can’t modify hash):
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `[]=’


1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:431:in find_by_sql’

There’s no another therad in my problem, I have no idea how comes ruby will raise such security exception.
I tried to lower the safelevel in dispatch.fcgi

#!/usr/local/bin/ruby -T0

or add line

$SAFE = 0

but it still doesn’t work.

Any idea how to set the $SAFE (or safelevel) in rails ? Or how to avoid this SecurityError ?