markevans/dragonfly — Issue #176: Models inside endpoints
Author: tmeasday
Created: 2012-03-02 03:24:53+00:00
State: open

If I do something along the lines of

```ruby
match '/post/:id' => Dragonfly[:images].endpoint { |params, app|
Post.find(params[:id]).image.thumb('30x30')
}
```

Everything is fine. However if I return the model attachment directly:
```ruby
match '/post/:id' => Dragonfly[:images].endpoint { |params, app|
Post.find(params[:id]).image
}
```

I get:
```ruby
NoMethodError (undefined method `unique_signature' for #<#:0x007fdfdabe8388>):
```

So I am forced to hack my around it like so:
```ruby
app.fetch(Post.find(params[:id]).image_uid)
```

I suppose this would be pretty simple to fix? Unless I am missing something.

Cheers,
Tom