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
精彩评论