Issue
This Content is from Stack Overflow. Question asked by opensource-developer
I recently updated rails application from 4.0
to 4.1
. When I try to execute Department.where("conditions").all(:include => [:users])
this give the following error
ArgumentError: wrong number of arguments (given 1, expected 0)
Any help on how to fix this would be great, Thanks.
Solution
It is strange because all
in 4.0 has not arguments
But 3.2 has
Probably the problem occurred during the upgrade from 3.2 to 4.0, not from 4.0 to 4.1
You need to replace your query using includes
to
Department.includes(:users).where("conditions")
And you don’t need all
This Question was asked in StackOverflow by opensource-developer and Answered by mechnicov It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.