express-resource icon indicating copy to clipboard operation
express-resource copied to clipboard

Singular resources

Open tj opened this issue 14 years ago • 9 comments

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

tj avatar Apr 10 '11 04:04 tj

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

gf3 avatar Apr 10 '11 04:04 gf3

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

tj avatar Apr 10 '11 04:04 tj

Makes sense to me.

gf3 avatar Apr 10 '11 04:04 gf3

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.

macavon avatar Apr 10 '11 18:04 macavon

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.

tj avatar Apr 10 '11 18:04 tj

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

macavon avatar Apr 10 '11 18:04 macavon

yup, that's the plan

tj avatar Apr 10 '11 19:04 tj

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.

macavon avatar Apr 20 '11 19:04 macavon

I guess nobody is working on this anymore?

sgronblo avatar Jan 08 '14 09:01 sgronblo