Sha256: 9deb02b34aabb1a3d28e5497f6eeeb9301a5070c54853c442d0d7286ba65571d

Contents?: true

Size: 447 Bytes

Versions: 3

Compression:

Stored size: 447 Bytes

Contents

require 'chillout/creations_container'

module Chillout
  module CreationListener
    def inherited(subclass)
      super
      class_name = subclass.name
      subclass.after_commit :on => :create do
        Rails.logger.info "[Chillout] Model created: #{class_name}"
        Thread.current[:creations] ||= CreationsContainer.new
        creations = Thread.current[:creations]
        creations.increment!(class_name)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chillout-0.6.0 lib/chillout/creation_listener.rb
chillout-0.5.4 lib/chillout/creation_listener.rb
chillout-0.5.3 lib/chillout/creation_listener.rb