chourobin
10/18/2012 - 7:24 PM

Ensure not referenced by another record

Ensure not referenced by another record

  before_destroy :ensure_not_referenced_by_any_line_item
  def ensure_not_referenced_by_any_line_item
    if line_items.count.zero?
      return true
    else
      errors[:base] << "Line Items Present"
      return false
    end
  end