views:

166

answers:

1

Hi everyone,

Very quick question. My server is warning me that line 37 will be deprecated, specifically:

#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 %>

Here's my confusion. Line 36 project.id isn't raising a warning, so I assume the issue is that I'm calling ID on the Matching model. Why is it the case that only Matching raising an error and not customer or project? How can I rectify this in my code?

Thanks very much.

+2  A: 

Either @customer or your Matching object is probably nil. nil.id is a deprecated method referring to nil's object ID.

Check that both @customer and the Matching object you get contain something before going ahead with this part of the template, and you should be fine.

Matchu