app/models/fiscal_year.rb
# Ensures there is always at least one active fiscal year
Ensures there is always at least one active fiscal year
Ensures there is always at least one active fiscal year
def at_least_one_active_fiscal_year
    return true if self.active
    if FiscalYear.active_fiscal_years.where("id != ?", self.id).length < 1
      self.errors.add(:active, "Must have at least one active fiscal year")
    end
  end
def at_least_one_active_fiscal_year return true if self . active if FiscalYear . active_fiscal_years . where ( "id != ?" , self . id ) . length < 1 self . errors . add ( :active , "Must have at least one active fiscal year" ) end end
Ensures there is always at least one active fiscal year
Ensures there is always at least one active fiscal year