Hello,
What is wrong with my finder method? I have the following (using
Rails 2.2.2):
active_rows = Model.find(:all, :conditions => ["status
in ?", ACTIVE_STATUSES])
ACTIVE_STATUSES is a constant array with 4 status codes in it. The
above rails line of code results in the following SQL SELECT
statement:
SELECT * FROM model
WHERE (status in ‘AR’,‘GA’,‘GP’,‘GS’)
This is incorrect SQL - it should be written as:
SELECT * FROM model
WHERE status in (‘AR’,‘GA’,‘GP’,‘GS’)
Notice that the right-paren is in the wrong place. How can I change
my statement to generate the correct SQL? I always assume that my
code is wrong, but could this be a bug is Rails code?
Thank you