Module: Sequel::Plugins::Timestamps::InstanceMethods

Defined in:
lib/cortex_reaver/support/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#before_createObject

Create



7
8
9
10
11
12
13
14
15
16
# File 'lib/cortex_reaver/support/timestamps.rb', line 7

def before_create
  return false if super == false

  unless skip_timestamp_update?
    self.created_on = Time.now
    self.updated_on = Time.now
  end

  true
end

#before_updateObject

Update



19
20
21
22
23
24
25
26
27
# File 'lib/cortex_reaver/support/timestamps.rb', line 19

def before_update
  return false if super == false

  unless skip_timestamp_update?
    self.updated_on = Time.now
  end

  true
end

#skip_timestamp_update=(boolean) ⇒ Object



29
30
31
# File 'lib/cortex_reaver/support/timestamps.rb', line 29

def skip_timestamp_update=(boolean)
  @skip_timestamp_update = boolean
end

#skip_timestamp_update?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/cortex_reaver/support/timestamps.rb', line 33

def skip_timestamp_update?
  @skip_timestamp_update
end