开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜