opensource-developer
opensource-developer

Reputation: 3038

Rails ActiveRecord: ArgumentError: wrong number of arguments (given 1, expected 0)

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.

Upvotes: 0

Views: 863

Answers (1)

mechnicov
mechnicov

Reputation: 15248

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

Upvotes: 3

Related Questions