carrierwave-meta icon indicating copy to clipboard operation
carrierwave-meta copied to clipboard

Clarity: What should happen when I fetch a record from the DB?

Open cgat opened this issue 10 years ago • 1 comments

Hi,

Currently, if I create a record that utilizes carrierwave::meta on its carrierwave mounted column, the metadata is loaded as instance values. If I fetch the record again my_model= MyModel.find(1) though, I have to manually call my_model.image.store_meta to get the metadata to load. I'm wondering if this is by design? If so, I guess the best way to handle this case is to call the store_meta method on the uploader in an initialization callback.

Btw, love the gem.

cgat avatar Jan 24 '14 12:01 cgat

hmmm, actually, calling store_meta directly on the uploader seems to trigger a cache (via the manipulate in get_dimensions), which causes another call to store_meta via the retrieve_from_cache callback. Obviously I don't want this to happen.

So if metadata can't be retrieved when fetching previously uploaded records, what's the use case when not persisting these values in a database column?

cgat avatar Jan 24 '14 12:01 cgat