change in behavior when exposing a resource, which has no plural form #60

Closed
senny opened this Issue Oct 12, 2012 · 2 comments

Comments

Projects
None yet
3 participants

senny commented Oct 12, 2012

The previous versions of decent_exposure exposed the singular resource when you exposed a resource, which has no plural:

expose(:sheep)

This used to expose a singular resource but with decent_exposure 2.0 it exposes the collection. Of course this breaks our application and is not handy to fix.

Since the collection can more easily be represented with the block form I suggest to change the behavior back to how it was.

decent_exposure 1.x

if respond_to?(collection) && collection != name.to_s && send(collection).respond_to?(:scoped)

decent_exposure 2.x

if plural?

I think it would be enough to add the collection != name.to_s to the plural? query.

Contributor

voxdolo commented Oct 12, 2012

Implementation aside, we shouldn't be treating the exposure as the collection when the resource is "uncountable". Thanks for catching this. I've added a 2.0.1 release milestone and added this to it. Please feel free to submit a pull request, otherwise @jgdavey or I will get to it as soon as we can.

senny commented Oct 12, 2012

Thanks for the heads-up.

@jgdavey jgdavey closed this in b76712f Oct 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment