I have the following code in my Calls controller:
@calls = Call.where(:destination => ("1234"),
:destination => ("5678"),
:destination => ("91011"))
Although the above code works, it’s only listing records with a destination of 91011. I would somehow like to show all records of which the destination field matches any of the numbers.
I’m unsure as to whether or not I should be adding a .where statement for each filter or not.
Any help would be appreciated!
This is very similar to another question I asked a while ago. However, that was to further filter a find condition rather than widen the scope.
Try this:
Also, if you’re on ruby 1.9, you can use the new hash syntax:
Update:
For a limit, there’s a method
I strongly suggest you read about ActiveRecord Query Interface, it’s awesome!