preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr

Lawrence Pit lawrence.pit at gmail.com
Mon Jan 21 08:11:04 UTC 2013


> That being said, I'm extremely surprised there is no published unicorn
> startup scripts that consider the common use case of a deployment
> stack that includes:
> Rails + Active Record
> Redis
> Memcache

http://unicorn.bogomips.org/examples/unicorn.conf.rb

In the after_fork you want:

    Rails.cache.reset

or if you're using an older version of the memcache gem (i.e. you're not 
using the dalli gem which I highly recommend) you may need this hack:

   if Rails.cache.is_a?(ActiveSupport::Cache::MemCacheStore)
     Rails.cache.instance_variable_get(:@data).reset
   end

If you use the UUID gem you need this in your after_fork:

   UUID.generator.next_sequence

As for redis:

   
https://github.com/redis/redis-rb/blob/master/examples/unicorn/unicorn.rb


Cheers,
Lawrence


More information about the mongrel-unicorn mailing list