I'm using Rails-3 with psql
My problem is little bit funny. I don't know why its not working.
When I'm using this code everything is working perfectly
if @sd.supplier_document_users.first.status.eql?("Waiting")
@sd.supplier_document_send_to_fi_user_lists.destroy_all
@sd.supplier_document_users.first.destroy
@fi_destroy_status = true
end
Here @sd.supplier_document_users
return []
after this
When I add this if condition (if !@sd.supplier_document_users.blank?) like this
if !@sd.supplier_document_users.blank?
if @sd.supplier_document_users.first.status.eql?("Waiting")
@sd.supplier_document_send_to_fi_user_lists.destroy_all
@sd.supplier_document_users.first.destroy
@fi_destroy_status = true
end
end
Here @sd.supplier_document_users
return value which I destroy above ( @sd.supplier_document_users.first.destroy)
I don't know what ghost come in my code.