On Oct 14, 4:14 am, Nate Wiger <[email protected]> wrote: > Actually looks like it's just misuse of the Sequal API on my part, but > perhaps User[1,2,3,4,5] should be an extension? > > I'm not heartset at all since this works fine: > > User.filter(:id => [1,2,3,4,5]) > > This might not have come up either because nobody tried it, or because > mysql throws a decent error: > > I, [2009-10-14T04:03:12.339093 #24911] INFO -- : SELECT * FROM > `games` WHERE `id` = (1, 2, 3) > /Users/nwiger/Workspace/sequel/lib/sequel/adapters/mysql.rb:157:in > `query': Mysql::Error: Operand should contain 1 column(s) > (Sequel::DatabaseError) > > So at the least maybe Sequel should throw a cleaner error?
I'm hesitant to add defensive type checking all over the place just to check misuse of the API. Sequel does so in a few parts where misusing the API fails in ways hard to detect or works but does things you don't expect (dataset[2]). In this case, the database will raise an error when you call the method, so it's pretty easy for you to spot your mistake and fix your code. For what you want, you can do: User[:id => [1,2,3,4,5]] Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
