[Rails] Bind Variables in Active Record

Tobias Luetke tobias.luetke at gmail.com
Tue Dec 7 05:31:00 GMT 2004


I also agree that the old style can just be transformed into ? by way
of a simple regexp or similar. Once the prepared statement is in
activerecord i'm sure you will see it everywhere as recommendet style
and the printf style will disappear quickly. Its one of those rare
cases where the new style has only advantages over the old style
unless i'm missing something.

On Mon, 6 Dec 2004 23:08:39 -0500 (EST), Dave Steinberg
<dave at redterror.net> wrote:
> > 2) Mixing ? and %s is not supported i.e  find_all(["id=? and
> > first_name like '%s'", 3 "''''bob'''\'?"])
> >
> > Is there a legitimate case for this kind of query?
> 
> I'd agree with the other comment, I don't think this sort of style should
> be encouraged.  I'd vote for converting it into "?"s as the other posted
> suggested at least as a transitionary measure, and deprecating it if
> possible.


-- 
Tobi
http://blog.leetsoft.com


More information about the Rails mailing list