0
嗨我的日誌文件中收到以下警告。因此,新手我想知道這是什麼警告,以及如何解決它。rails在我的日誌文件中獲取DEPRECATION警告
DEPRECATION WARNING: Calling #find(:all) is deprecated. Please call #all directly instead. You have also used finder options. These are also deprecated. Please build a scope instead of using finder options. (called from user_rating at /home/raj/Desktop/webapp/app/controllers/company_ratings_controller.rb:73)
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from user_rating at /home/raj/Desktop/webapp/app/controllers/company_ratings_controller.rb:73)
這是我在73線company_ratings_controller:
def user_rating
company_id = current_user.profile.companies.map(&:id)
rating = current_user.company_ratings.find(:all,:conditions=>["user_id = ? and company_id IN (?)",current_user.id,company_id]) [line 73]
end
請分不清什麼是我的問題是什麼原因造成了我所有的錯誤
NK你現在我明白 – user3144005