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

Time:09-19

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.

CodePudding user response:

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

  • Related