Singular resources #6

Open
tj opened this Issue Apr 10, 2011 · 9 comments

Projects

None yet

4 participants

@tj
Member
tj commented Apr 10, 2011

we could use lingo.en.isSingular() to detect and auto-magically support this

@gf3
gf3 commented Apr 10, 2011

I suppose it depends on how opinionated you want to be.

@tj
Member
tj commented Apr 10, 2011

we definitely have to be flexible, but I think we can do magic, and retain the flexibility

@gf3
gf3 commented Apr 10, 2011

Makes sense to me.

@macavon
macavon commented Apr 10, 2011

You mean that resource('profile', actions) makes a singular resource and resource('users', actions) a plural one, right? This seems intuitively appealing, but you know someone's going to try resource('sheep', actions) don't you? So maybe you do need some way of disambiguating or over-riding the convention.

Also, presumably people will immediately start wanting to use different languages. Words ending in 's' will look the same singular and plural in French, also Spanish apparently.

@tj
Member
tj commented Apr 10, 2011

that's the idea, it would basically just expand at the API level, so something like resource('profile') would make a call to say singularResource('profile') similar, allowing the call to be explicit when needed but still adding some sugar on top of the high level portion of the API. Just a thought.

@macavon
macavon commented Apr 10, 2011

It's a very good thought, but you might be wise to expose singularResource anyway, to get round the awkward cases.

@tj
Member
tj commented Apr 10, 2011

yup, that's the plan

@macavon
macavon commented Apr 20, 2011

I still like the idea of using magic, but I've just sent a pull request with a different way of doing it.

I'm sure I must have missed something, otherwise it's too easy.

@sgronblo
sgronblo commented Jan 8, 2014

I guess nobody is working on this anymore?

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