voxdolo/decent_exposure — pull request #75 by haihappen (2013-02-25 09:34:50+00:00)
Title: Pass name to the options hash.

When I use an exposure like this one

```ruby
exposure :published_documents, model: Document
```

the inflector will get the Document class and not the name of the exposure as parameter. This will work fine, unless you start using your own strategies (this one uses Draper to decorate all resources):

```ruby
class DecoratedStrategy < DecentExposure::StrongParametersStrategy
def singular_resource
decorator.decorate(super)
end

def collection_resource
decorator.decorate_collection(super)
end

private
def decorator
"#{inflector.singular.classify}Decorator".constantize
end
end
```

The problem is, that the inflector for my `published_documents` will always return `false` when calling `plural?` on it, because he is only testing the Document class name which will never be plural.

**Two solutions**

1. We could pass the name of exposure to the inflector, even if a custom `:model` option is used. This could maybe break existing exposures.

2. Or we could just pass the name of the exposure to the options hash, so each exposure is aware of its own name (and we can later do fancy stuff with it).

This is the pull request for option 2! @voxdolo, please let me know what you think. :)

-@haihappen