Sha256: 78ec3113c894eb4b55cc814ab062a55f9b6fc1ea03435718d7d2d8b7ebaca43f
Contents?: true
Size: 458 Bytes
Versions: 23
Compression:
Stored size: 458 Bytes
Contents
module ActiveUUID module UUID def self.included(base) base.before_validation :fix_uuid_strings end def fix_uuid_strings self.class.columns_hash.each do |key, fk| next unless fk.type == :binary && fk.limit == 255 && /^.+_id$/.match(key.to_s) value = self.send fk.name if !value.blank? && value.class != UUIDTools::UUID self.send "#{fk.name}=", value.to_uuid end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems