Set cache key to data object when using undefined variable

Currently when you want to use a cache key prefix and use `extends`  will cause an empty cache key.

For example:

# sites/index
```rabl
collection @sites
extends 'resources/sites/show'
```

# sites/show
```rabl
object @site
cache @site

attributes :id, :name
```

In the `show` template @site is undefined and therefor cache key can't find an object to call `cache_key` on.

This also fixes @rymai's issue in #490