hi
i have some conditions to pass to a finder. The problem is that i don't want to pass in an usafety way. So imagine that i receive a hash:
hash = {:start_date=>'2009-11-01',:end_date=>'2010-01-23'}
i would like to pass it to my finder like:
Model.find(:all,:conditions=>"created > '#{start_date}' and created < '#{end_date}'")
The problem is that it is unsafe and i'm exposed to SQL injection problems. My question is, how would be the best way to compose this condition?
I want to do it dynamically. For example, i'm doing today like:
find_condition = ['created > ? and created < ?','2009-10-01','2010-01-01']
Model.find(:all,:conditions=>find_condition)