Thursday, March 18, 2010

[Rails] Re: Symbol as array index error ?

On Mar 18, 4:59 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:

> Because @monkey is a hash what gets yielded to you is an array, the
> first element is the key (ie '133' or '145') and the second is the
> value, whereas your code seems to assume that x is a hash.

Sorry for being so dense, but why does

@monkey.delete_if{ |k,v| v[ "value" ] == '' }

Throw the same error? Any idea what the proper syntax would be to
delete the element for which value is blank?

TIA,
Craig

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment