Sha256: 777ac0c96ac80e690313f6b695572ad38adc39f12aeae21f2c0d8be723ca1dd3
Contents?: true
Size: 552 Bytes
Versions: 1
Compression:
Stored size: 552 Bytes
Contents
module Sid module InstanceMethods def sid_column=(value) self.send :"#{self.class.sid_config[:sid_column]}=", value end def sid_column self.send :"#{self.class.sid_config[:sid_column]}" end private def set_sid_column scoped_by = self.class.sid_config[:scoped_by] collection = self.class.where(scoped_by => self.send(scoped_by)) if collection.count.zero? self.sid_column = 1 else self.sid_column = collection.reorder('id').last.sid_column + 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sid-0.0.3 | lib/sid/instance_methods.rb |