undefined method `stringify_keys!' for "4":String - Meaning of this?

Hi, I have the following on a view

<% for evaluation in @evaluations %>
      <td><%=h evaluation[0].name %></td>
      <td><%=evaluation[1].object_id %></td>
     <td><%= link_to( "Start", :action =>'evaluatie', :id =>
evaluation[1].object_id) %></td>

When I click on the link, I can see that I do get a Parameters:
{"id"=>"4"} request.

In my controller I just have

def evaluatie
idee = Evaluation.new(params[:id])
@ideename= idee.name

For some reason, I get the message "undefined method
`stringify_keys!' for "4":String"
Can anyone explains what that means? It is the first time I encounter
Many thanks for any reply.

If you're using ActiveRecord, then you probably meant to use .id rather than .object_id (and the fact that nil.object_id == 4 is pointing toward another error).

Evaluation.new expects to have an attribute hash and your params[:id] is just "4" which is the object_id of nil meaning evaluation[1] is nil and evaluation is coming from the Enumerable @evaluations. Using [1] on it appears to indicate that it is an Array or some other type that provides an array-like accessor using the [] method.

I suspect that you could use a good, basic tutorial (or a book) on Rails. I'm sure Google will help with that search.


Rob Biedenharn http://agileconsultingllc.com