Else statement not working in active admin. Any help will be appreciate it
show do
attributes_table do
row :id
row :user
if :address_id.empty?
row :user_id do |n|
n.user.address
end
row "Phone",:user_id do |n|
n.user.phone
end
else
row :address_id do |n|
n.addresses.last&.name
end
row "Phone",:address_id do |n|
n.addresses.last&.phone
end
end
end
end
the result of my codes is when the address_id is empty the result will be empty not this row :address_id do |n| n.addresses.last&.name end row "Phone",:address_id do |n| n.addresses.last&.phone end
Aucun commentaire:
Enregistrer un commentaire