Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 0.33 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class Story < Ohm::Model
  2.  
  3.   include Celluloid
  4.  
  5.   attribute :url
  6.   index     :url
  7.  
  8.   @pool = Celluloid::Pool.new(Story, {initial_size:10,max_size:100})
  9.  
  10.   class << self; attr_accessor :pool end
  11.  
  12.   def self.new
  13.     @pool.get
  14.   end
  15.  
  16.   # something like this to control things
  17.   def after_save
  18.     self.terminate
  19.     @pool.put(self)
  20.   end
  21.  
  22. end