Undefined method `stringify_keys!' for "4":String - Meaning

Hi, I have the following on a view

<% for evaluation in @evaluations %>

<%=h evaluation[0].name %>
<%=evaluation[1].object_id %>
<%= link_to( “Start”, :action =>‘evaluatie’, :id =>
evaluation[1].object_id) %>
<%end%>

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
end

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
this.
Many thanks for any reply.

On Nov 20, 2006, at 4:36 PM, Rudy wrote:

{“id”=>“4”} request.
Can anyone explains what that means? It is the first time I encounter
this.
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

Rob B. http://agileconsultingllc.com
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs