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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -