zand3rs / sails-factory

Sails Factory
ISC License
16 stars 7 forks source link

inflection.classify causes the model name to change #4

Closed luiselizondo closed 9 years ago

luiselizondo commented 9 years ago

I have a model that I named "Data", the problem is that when I try to use Factory.create the name of the model changes to "datum" which doesn't exists as a model and the module throws an error.

The line that is causing this is the line 137

var modelId = inflection.classify(factory.modelName).toLowerCase();

Everything works as expected if I remove inflection.classify and change it to:

´´´ var modelId = factory.modelName.toLowerCase(); ´´´

Before I make a patch can you please clarify why use inflection.classify? This is not a module I'm familiar with but from what I understand, the classify method just changes the name of the model, is that necessary? If so, how can we solve this kind of situations when the model changed because of inflection and then sails doesn't detect it.