They refactored the code for the better to make them all properties.
Take a look at some examples, e.g. in dm-types, to see how new
properties are done.
e.g.
module DataMapper
class Property
class Csv < Text
def primitive?(value)
super || value.kind_of?(::Array)
end
def load(value)
case value
when ::String then CSV.parse(value)
when ::Array then value
else
nil
end
end
def dump(value)
case value
when ::Array then CSV.generate { |csv| value.each { |row|
csv << row } }
when ::String then value
else
nil
end
end
end # class Csv
end # class Property
end # module DataMapper
Also a few other changes.. like property.primitive instead of
property.type..
(I'm in the midst of porting various non-sql adapters from 0.10.2 to
1.0.0...)
-Gary
On Jun 15, 11:55 pm, zakjan <[email protected]> wrote:
> Hi,
>
> why Datamapper::Type is deprecated and how to rewrite it?
>
> FacebookUid < DataMapper::Type is deprecated, use the new
> DataMapper::Property API instead (/home/zakjan/.rvm/gems/ruby-1.8.7-
> p249/gems/dm-validations-1.0.0/lib/dm-validations.rb:41:in `new')
>
> class FacebookUid < DataMapper::Type
> primitive Integer
> min 1
> max 2**64-1
> end
>
> I am using DM 1.0.
>
> Thanks, JZ
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.