How can I apply validation on array elements so that it can raise an error that it can not be blank ??
validates :my_arr , presence: true
It will check [" "].present? which will return true.But I need to check its element my_arr.last.
I have implemented following one in my model:
if self.dma_area.last.blank? errors.add(:dma_area, "should be selected") end
I have tried it with lot of other option like (allow_blank: false exclusion etc) and I found above one is working but I am in doubt whether it is in rails standards.
Is above solution is fine according to rails standards/conventions.??
Waiting for good working solution.