Sha256: bb5e3f8f98721dca1c0e814b98c81c5d34bf9d185e25128f81d150e297795f8c

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

module SimpleFactory
  module ActiveRecord
    module TimeMachine
      def self.included(klass)
        klass.class_eval do
          after_create do |model, params|
            model.created_at = params[:created_at] if params.key?(:created_at)
            model.updated_at = params[:updated_at] if params.key?(:updated_at)
            model.save
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_factory-0.1.0 lib/simple_factory/active_record/time_machine.rb