Rudy
2006-Nov-20 21:36 UTC
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> <%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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn
2006-Nov-22 17:59 UTC
Re: undefined method `stringify_keys!'' for "4":String - Meaning of this?
On Nov 20, 2006, at 4:36 PM, Rudy wrote:> 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> > <%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.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 Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- Challenge for object_id, Garbage Value
- [PATCH server] Fixed db-omatic so it doesn't segfault because of newer qmf api.
- Problems with Object#id deprecation
- [PATCH server] Update daemons to use new QMF.
- Updating oVirt Server to the latest Matahari 0.4.0 schema