Sha256: e09446a755c7eacb79425c2e5a6590dce54857f9806e89e56a2c694507653d27

Contents?: true

Size: 293 Bytes

Versions: 10

Compression:

Stored size: 293 Bytes

Contents

module Rostra
  module TimestampObserver

    def self.included(base)
      base.after_create :set_active_at
    end

    private

    def set_active_at
      question = self.is_a?(Rostra::Question) ? self : self.question
      question.update_attribute(:active_at, Time.now)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rostra-0.3.6 lib/rostra/timestamp_observer.rb
rostra-0.3.5 lib/rostra/timestamp_observer.rb
rostra-0.3.4 lib/rostra/timestamp_observer.rb
rostra-0.3.3 lib/rostra/timestamp_observer.rb
rostra-0.3.2 lib/rostra/timestamp_observer.rb
rostra-0.3.1 lib/rostra/timestamp_observer.rb
rostra-0.2.1 lib/rostra/timestamp_observer.rb
rostra-0.2.0 lib/rostra/timestamp_observer.rb
rostra-0.1.26 lib/rostra/timestamp_observer.rb
rostra-0.1.25 lib/rostra/timestamp_observer.rb