Apologies if this should be separated into a separate thread but this
reminded me of a question I had when writing some search methods
recently.

What, if any, are the differences between the following two find
statements?

On Aug 20, 2:33 am, Michael Pavling <[email protected]> wrote:
> On 20 August 2010 07:17, Srikanth Jeeva <[email protected]> wrote:
>
> Model.all(:conditions => ["created_at BETWEEN ? AND ?", Date.today,
> Date.tomorrow])

-and-

Model.all(:conditions => {:created_at => Date.today..Date.tomorrow})

Is the choice just a personal coding preference or is there some
performance or security differences between the two?  It's my
understanding that the array form's design was to help prevent sql
injection attacks but I was unsure if you lost that benefit by using
the hash form with a range.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to