Skip to content

Instantly share code, notes, and snippets.

@skylar
Created August 23, 2012 02:28
Show Gist options
  • Select an option

  • Save skylar/3431512 to your computer and use it in GitHub Desktop.

Select an option

Save skylar/3431512 to your computer and use it in GitHub Desktop.
require 'dm-core'
require 'money'
module DataMapper
class Property
class Money < Object
# load_as ::Money
# dump_as ::String
# coercion_method :to_money
def dump(v)
v.to_s
end
def load(v)
self.typecast_to_primitive(v)
end
def typecast_to_primitive(v)
v.to_money
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment