On 27 Jun 2011, at 04:56, Shanison wrote:

> Hi William,
> 
> Thank you very much for your detailed explanation and suggestion. This
> is very helpful. For my case, actually it is for railover, so I think
> I have to use rSync or write an extension that money patch the asset
> manager, where upon any files uploaded to the server, I can do a
> synchronization.
> 
> This is a bit trouble though. We have also thought of storing all
> assets in the db instead. Synchronization of db is much easier and
> efficient. But this means that we have to money patch the asset
> manager again to make it store in db instead of file system.

That would probably be easier to code: it's just a different paperclip storage 
module. See eg.

        
http://patshaughnessy.net/2009/4/14/database-storage-for-paperclip-rewritten-to-use-a-single-table

but it doesn't feel like a very appealing solution. You would miss out on a lot 
of server-side optimisation: delivering static files is always the way to go if 
you can.

It should be fairly easy to trigger a script from the asset manager. Again, 
it's not our code but the behaviour of Paperclip that you need to change. Have 
a look at the flush_writes and flush_deletes methods in 
Paperclip::Storage::Filesystem. If I was doing this I think I'd add 
:after_storage and :after deletion callbacks.

best,

will

Reply via email to