This is probably more of a ruby question, but I'm posting it here as
HashWithIndifferentAccess is more of a rails thing.

I have a @morton which is

--- !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: ""

I'd like to delete the new_lab_data_attributes with value = nil

I've tried various incarnations of

@morton[ :new_lab_data_attributes ].each{ |x| x.delete if x[ :value ]
== nil }

But nothing seems to be removing those entries.  Part of my problem is
that I can't quite figure out the key value pairs in this.  It almost
seems that the inner  !map:HashWithIndifferentAccess are symbols for
keys--is that right?

Anyway, a method to remove those inner hashes depending on the "value"
would be greatly appreciated.

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

Reply via email to