Class Index [+]

Quicksearch

Sequel::Plugins::Timestamps::InstanceMethods

Public Instance Methods

before_create() click to toggle source

Set the create timestamp when creating

    # File lib/sequel/plugins/timestamps.rb, line 66
66:         def before_create
67:           set_create_timestamp
68:           super
69:         end
before_update() click to toggle source

Set the update timestamp when updating

    # File lib/sequel/plugins/timestamps.rb, line 72
72:         def before_update
73:           set_update_timestamp
74:           super
75:         end

Private Instance Methods

set_create_timestamp(time=nil) click to toggle source

If the object has accessor methods for the create timestamp field, and the create timestamp value is nil or overwriting it is allowed, set the create timestamp field to the time given or the current time. If setting the update timestamp on creation is configured, set the update timestamp as well.

    # File lib/sequel/plugins/timestamps.rb, line 84
84:         def set_create_timestamp(time=nil)
85:           field = model.create_timestamp_field
86:           meth = :"#{field}="
87:           self.send(meth, time||=Sequel.datetime_class.now) if respond_to?(field) && respond_to?(meth) && (model.create_timestamp_overwrite? || send(field).nil?)
88:           set_update_timestamp(time) if model.set_update_timestamp_on_create?
89:         end
set_update_timestamp(time=nil) click to toggle source

Set the update timestamp to the time given or the current time if the object has a setter method for the update timestamp field.

    # File lib/sequel/plugins/timestamps.rb, line 93
93:         def set_update_timestamp(time=nil)
94:           meth = :"#{model.update_timestamp_field}="
95:           self.send(meth, time||Sequel.datetime_class.now) if respond_to?(meth)
96:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.