Skip to content

Instantly share code, notes, and snippets.

@jcsrb
Created July 7, 2011 11:11
Show Gist options
  • Save jcsrb/1069312 to your computer and use it in GitHub Desktop.
Save jcsrb/1069312 to your computer and use it in GitHub Desktop.
find the gap
class DocumentSeries < ActiveRecord::Base
#...
#
# this returns an array of the free counter numbers in the series
#
def empty_series_counter_slots
(self.counter_start .. self.counter_current).to_a - self.documents.collect{|d| d.document_series_counter}
end
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment