rubyonrailsin

A Ruby and Rails talk

Tuesday, March 16, 2010


[Rails] Re: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

On Mar 16, 10:11 am, Michael Pavling <pavl...@gmail.com> wrote:

> It was your syntax! :-) I just changed "== nil" to ".blank?"
> Look at the docs for Hash:http://ruby-doc.org/core/classes/Hash.html#M002870
>
> Looks like just dropping the "if" would work...

Oops, you were right about that (I'm so addled by trying different
things at this point, that I'm not seeing the obvious) but it still
doesn't work:

@morton[:new_lab_data_attributes].each{ |x| x.delete
x[ :value ].blank? }
raise @morton.to_yaml

--- !map:HashWithIndifferentAccess
new_lab_data_attributes:
- !map:HashWithIndifferentAccess
unit_id: "4"
lab_desc_id: "3"
value: ""
- !map:HashWithIndifferentAccess
unit_id: "2"
lab_desc_id: "2"
value: ""

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

Subscribe feeds via e-mail

Blog Archive