2
可能重複:
Rails primary key and object idRails:Object#id將被棄用;使用對象#OBJECT_ID
非常快速的問題。我的服務器警告我說,行37將被棄用,具體有:
#Server error:
views/projects/index.html.erb:37: warning: Object#id will be deprecated; use Object#object_id
#Views/projects/index.html.erb:
6: <% for project in @projects do %>
36: <%= project.id %>
37: <%= Matching.find_all_by_customer_id_and_project_id(@customer.id, project.id).id %>
38: <%= @customer.id %>
這裏是我的困惑。第36行project.id沒有提出警告,所以我認爲問題在於我在匹配模型上調用ID。爲什麼只有匹配引發錯誤而不是客戶或項目?我如何在我的代碼中糾正這個問題?
非常感謝。