ruby array iteration and cheking for nil value -
i have @banners object. want iterate through each element of array , want pluck :picture_file_name. want check whether each picture_file_name nil or not. doing this
if @banners.present? , @banners.pluck(:picture_file_name) == [nil]
but not getting proper result
assuming it's "if ':picture_file_name's nil" :
if @banners.present? , @banners.pluck(:picture_file_name).all?(&:nil?)
in case checking "if ':picture_file_name's not nil" :
if @banners.present? , @banners.pluck(:picture_file_name).all?
Comments
Post a Comment