#101 ✓resolved
Loïc

arrays don't work for SQL IN() statement

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

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.

Comments and changes to this ticket

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Attachments

Tags

Pages