On 16 March 2010 13:54, Dudebot <[email protected]> wrote:
> 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
>

none of them are nil - they're empty strings....

You could try "blank?" (it might work):
  @morton[:new_lab_data_attributes].each{ |x| x.delete if x[:value].blank? }

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