получение данных почты шимпанзе .each rails - PullRequest
0 голосов
/ 05 ноября 2018

данных я хочу получить данные, где REF_CODE будет ноль, как я могу получить эти поля с помощью цикла или .ech

@ body = {"members" => [{"merge_fields" => {"REF_CODE" => "", "ROOT_URL" => "ali.com"}}, {"merge_fields" => {"REF_CODE "=>" 12asdja "," ROOT_URL "=>" columbusnaviggator.com "}}, {" merge_fields "=> {" REF_CODE "=>" 12asja "," ROOT_URL "=>" columbusnaviggator.com "}}, { "merge_fields" => {"REF_CODE" => "12asja", "ROOT_URL" => "columbusnaviggator.com"}}, {"merge_fields" => {"REF_CODE" => "asa12asdja", "ROOT_URL" => " columbusnaviggator.com "}}, {" merge_fields "=> {" REF_CODE "=>" 12assss "," ROOT_URL "=>" columbusnaviggator.com "}}, {" merge_fields "=> {" REF_CODE "=>" e5118ec91d "," ROOT_URL "=>" "}}, {" merge_fields "=> {" REF_CODE "=>" d5a20240aa "," ROOT_URL "=>" Columbusnavigator.com "}}, {" merge_fields "=> {" REF_CODE "=>" 09896bcf0c "," ROOT_URL "=>" localhost: 3000 "}}, {" merge_fields "=> {" REF_CODE "=>" b4a4876c09 "," ROOT_URL "=>" localhost: 3000 "}}]]}

1 Ответ

0 голосов
/ 05 ноября 2018
@body['members'].select {|a| a['merge_fields']['REF_CODE']== ''}
# [{"merge_fields"=>{"REF_CODE"=>"", "ROOT_URL"=>"ali.com"}}]

Выше будет возвращен массив полей с nil REF_CODE

...