markevans/dragonfly — Issue #134: More problems reading metadata
Author: jcarlson
Created: 2011-10-11 02:41:29+00:00
State: open

In reference to issue #130, this also seems to affect the generation of content URLs. Specifically, segments of the ```url_format``` that refer to metadata aren't available when the URL is generated. Here's an example:

```ruby
class Photo < ActiveRecord::Base

image_accessor :image
# details omitted for brevity

end
```

```ruby
>> p = Photo.first
Photo Load (0.2ms) SELECT "photos".* FROM "photos" LIMIT 1
=> #
>> p.image.thumb('200x200').url
=> "/media/BAhbB1sHOgZmIikyMDExLzEwLzEwLzE5XzMyXzE3XzI4MV9EU0NfMDE3MS5qcGdbCDoGcDoKdGh1bWIiDDIwMHgyMDA"
>> p.image.apply
=> # long response omitted
>> p.image.thumb('200x200').url
=> "/media/BAhbB1sHOgZmIikyMDExLzEwLzEwLzE5XzMyXzE3XzI4MV9EU0NfMDE3MS5qcGdbCDoGcDoKdGh1bWIiDDIwMHgyMDA/DSC_0171.jpg"
```

Notice how on the second call to ```url``` the ```:basename``` and ```:format``` segments are properly included?

This ends up creating different URLs for content depending on whether the metadata has been loaded or not, and thus makes it harder for browsers to make a cache-hit...

I'm happy to look at patching this, but I'm not sure where to start. Suggestions?