Class: DataMapper::Property::ParanoidDateTime

Inherits:
DateTime
  • Object
show all
Defined in:
lib/dm-types/paranoid_datetime.rb

Instance Method Summary collapse

Instance Method Details

#bindObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dm-types/paranoid_datetime.rb', line 9

def bind
  property_name = name.inspect

  model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
    include DataMapper::Types::Paranoid::Base

    set_paranoid_property(#{property_name}) { ::DateTime.now }

    default_scope(#{repository_name.inspect}).update(#{property_name} => nil)
  RUBY
end