简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM