When I create a Policy with yo : yo trails:policy Auth or yo trails:policy AuthPolicy, it's create me a file named api/policies/Auth.js with AuthPolicy class. In api/policies/index.js, I have exports.Auth = require('./Auth').
So to use my policy :
// config/policies.js
module.exports = {
ExampleController: {
test: [ 'Auth.test' ] // Should be AuthPolicy.test
}
}
I find this is not consistent regarding to the controllers and services system which add Controller and Service prefix to the new generated controller or service. So when I generate a policy, I should have AuthPolicy.js instead of Auth.js isn't it ?
Hi,
When I create a Policy with
yo
:yo trails:policy Auth
oryo trails:policy AuthPolicy
, it's create me a file namedapi/policies/Auth.js
withAuthPolicy
class. Inapi/policies/index.js
, I haveexports.Auth = require('./Auth')
.So to use my policy :
But in the example (readme.md) there is :
I find this is not consistent regarding to the
controllers
andservices
system which addController
andService
prefix to the new generated controller or service. So when I generate a policy, I should haveAuthPolicy.js
instead ofAuth.js
isn't it ?The same note applies to
models
too.