Skip to content

Instantly share code, notes, and snippets.

@bernerdschaefer
Created January 7, 2011 09:57
Show Gist options
  • Save bernerdschaefer/769304 to your computer and use it in GitHub Desktop.
Save bernerdschaefer/769304 to your computer and use it in GitHub Desktop.
module DataMapper
class Property
class Integer
# HACK: Unfortunately, datamapper doesn't seem to like setting
# association keys to blank strings, instead requiring something numeric
# or nil, so we must typecast blank values to nil.
def typecast(value)
value.blank? ? nil : super
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment