Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

arrays don't work for SQL IN() statement

#101

I think I found a little bug :

In your example you show that User.select { |m| [1, 2, 3, 4].include? m.id } is translated to "SELECT * FROM users WHERE users.id IN (1, 2, 3, 4)" and that's great.

But now if I assign my array to a variable, as array = [1,2,3], I can't use the variable properly.

Doing the following : User.select {|m| array.include? m.id } will not translate to "SELECT * FROM users WHERE users.id IN (1, 2, 3, 4)" as expected but to "SELECT * FROM users WHERE users.id IN ('--- \n- 2\n- 3\n- 4\n')"

It seems to get the yaml representation of the array.

Reported by Loïc · August 31st, 2007 @ 01:50 PM

State: resolved
Milestone: none
Assigned to: Chris Wanstrath Chris Wanstrath

Activity

  1. lifo
    lifo

    Attached patch works fine for me. But there might be a better way.

    September 1st, 2007 @ 02:46 PM

  2. Chris Wanstrath
    Chris Wanstrath
    • State changed from new to resolved

    September 1st, 2007 @ 03:26 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.