railsにて条件分岐をさせているのですが、下記のaという配列はコード2個目の通り、whereで絞り込んでおり、中身があったりなかったりします。ただ、aには0も入ることがあるため、0とnilは区別し、nil(配列の中身がカラ)だけを検出したい。
<% @thru_1h_start.zip(@thru_10h_start).each do|a,b| %> <% case %> <% when a.nil? %> ・・・
#変数aの内容 @thru_1h_start = Score.where(created_at: play_date.created_at.in_time_zone.all_day).where(course: params[:course]).where(hole_number: 1..9).where("hole_score is NULL").group(:round_id).minimum(:hole_number) @thru_10h_start = Score.where(created_at: play_date.created_at.in_time_zone.all_day).where(course: params[:course]).where(hole_number: 10..18).where("hole_score is NULL").group(:round_id).minimum(:hole_number)
試してみたこと
.any?や.empty?も試してみましたが、.nil?と結果はかわりませんでした。
実現したいこと
配列の中身がカラだったら、when文でtrueとしたい。
宜しくお願い致します。
追記
下記のリンクをみると、条件にマッチしないと、空の配列ではないと書いてありました。

https://qiita.com/nakayuu07/items/3d5e2f8784b6f18186f2
念のため、「0も入る」とはどういう状態でしょうか
ゴルフのスコアなので、PARだと0を入れます。
@thru_1h_startおよび@thru_10h_startはどのようなデータでしょうか?
#inspectや#to_jsonで文字列化(シリアライズ)できると思いますので、具体的にうまく行かない例をください。
<% @thru_1h_start.each do |key, value| %>
<p>key: <%= key %></p>
<p>value: <%= value %><br></p>
<% end %>
<% @thru_10h_start.each do |key, value| %>
<p>key: <%= key %></p>
<p>value: <%= value %><br></p>
<% end %>
実行結果
key: 683bc2ab3f8ece9d
value: 1
key: 2656bd31891aaf04
value: 3
key: 683bc2ab3f8ece9d
value: 18
key: 2656bd31891aaf04
value: 10
key: hoge
value: 11
@thru_1h_startの3つめ(key: hoge)が.where("hole_score is NULL")に対し、全てNULLではないので、配列には何も入らない状態です。