Reputation: 22948
I'm just trying out some stuff and I found something interesting, when I try to pass a string argument to the limit method I get an error.
Here is an example :
User.where('id > 10000').limit('ALL')
The error thrown is :
ArgumentError: invalid value for Integer(): "ALL"
This works of course :
User.where('id > 10000').limit(5)
But according to postgresql docs, should be possible to pass the ALL as a limit : http://www.postgresql.org/docs/8.1/static/queries-limit.html
And works on simple query from pgadmin that I tried :
select id from users limit ALL
Is there a workaround for rails with this error?
Upvotes: 0
Views: 395
Reputation: 5015
LIMIT ALL is the same as omitting the LIMIT clause.
I think the postgres docs are pretty clear here. Just remove the limit. i.e.
User.where('id > 10000')
Upvotes: 2