In sails.Js, how can i use a controller with two models?
like, in my page a have a reference <%= user.city%>,
in another model, i have a list like:
{
street
},
{
state
},
{
house
}
how can i do, to use <%= user.city.street%> in my page?
Info: i have two models, "User" and "Info", the list is in the info model.
Have you associate model "Info" in "User"?
Model User
city: {
model: "Info"
},
Now then populate city in controller,
User.find().populate('city').exec(function(err,users){res.view(users);});
so you can use <%= user.city.street%>