I want to overwrite some of the accessor methods in my AC model to convert to/from Ruby types, but I can't, as AC defines the accessor methods at initialization-time, not at class-creation-time like with AR.
As a work around, I can overwrite them in my initialize(), but that's a bit hacky:
class Foo < ActiveCouch::Base
has :stuff
def initialize( *args )
super
def self.stuff
@stuff ||= StuffType.new attributes[:stuff]
end
end
end
Ideally, I'd like to be able to pass a Ruby type to "has" and have AC do the casts and memoization.