开发者

rails - find_by_sql: wrong number of arguments (2 for 1)

开发者 https://www.devze.com 2023-03-23 14:45 出处:网络
Getting wrong number of arguments (2 for 1) for the code below...any ideas? @user_industry = current_user.industry

Getting wrong number of arguments (2 for 1) for the code below...any ideas?

@user_industry = current_user.industry

@industries = Listing.find_by_sql("SELECT * F开发者_如何学运维ROM listings WHERE industry = ?", @user_industry)


You have to use the same string replacement as with AR find

Listing.find_by_sql(["SELECT * FROM listings WHERE industry = ?", @user_industry])

API documentation

0

精彩评论

暂无评论...
验证码 换一张
取 消