Reputation: 516
I created model Pattern.js, looks this way:
var Pattern = {
adapter: 'land',
attributes: {
name: 'STRING',
code: 'STRING'
}
};
module.exports = Pattern;
And now I have two problems:
Upvotes: 0
Views: 6136
Reputation: 3382
Accessing models
You do not have to require the model yourself, Sails does this for you.
Every model you define is available in the global scope as Filename
(uppercase first letter) and in sails.models.filename
(all lowercase) by default after the orm
hook has run.
sails
is available in the global scope too.
Documentation
I do not know wich docs you refer to, but there is a create
method available on Sails / Waterline models. In your example:
Pattern.create(data).exec(callback);
You can look up on Sails / Waterline models here:
Upvotes: 2