title: Sails.js Data undefined
body: <p>I'm trying to create function named Edit function and update function to update items in the database bying using sails.js but its said Length it can't read property of undefined. I'm kinda stuck here, please help.</p>
  
  <p><a href="https://i.stack.imgur.com/uwP2w.png" rel="nofollow noreferrer">This is a picture of Edit and Update functions</a></p>
  
  <p><a href="https://i.stack.imgur.com/Y6VNu.png" rel="nofollow noreferrer">This is an error result that I got when I click on Edit button</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
   &lt;title&gt;Edit Item | Make4You&lt;/title&gt;
   &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"&gt;
   &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"&gt;&lt;/script&gt;
   &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"&gt;&lt;/script&gt;
   &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
   
   
   &lt;body&gt;
   
   &lt;h1 class=""&gt;Edit Item&lt;/h1&gt;
   &lt;form method="post" action="/item/update?id=&lt;%= items.id %&gt;"&gt; 
    &lt;div class="form-group"&gt;
     &lt;label for="title"&gt;Title&lt;/label&gt;
     &lt;input type="text" name="title" class="form-control" value="&lt;%= items.title %&gt;"&gt;
     &lt;label for="category_id"&gt;Category&lt;/label&gt;
     &lt;select name="category_id"&gt;
     &lt;% for (var j=0; j&lt;categories.length; j++){ %&gt;
     &lt;option value="&lt;% if(items[i].category_id == categories[j].id){ %&gt;"&gt;&lt;%= categories[j].name %&gt;&lt;/option&gt;
     &lt;% } %&gt;
     &lt;% } %&gt;
     &lt;/select&gt;
     &lt;label for="description"&gt;Description&lt;/label&gt;
     &lt;input type="text" name="description" class="form-control" value="&lt;%= items.description %&gt;"&gt;
     &lt;label for="width"&gt;Width&lt;/label&gt;
     &lt;input type="text" name="width" class="form-control" value="&lt;%= items.width %&gt;"&gt;
     &lt;label for="height"&gt;Height&lt;/label&gt;
     &lt;input type="text" name="height" class="form-control" value="&lt;%= items.height %&gt;"&gt;
     &lt;label for="price"&gt;Price&lt;/label&gt;
     &lt;input type="price" name="price" class="form-control" value="&lt;%= items.price %&gt;"&gt;
  
    &lt;/div&gt;
  
    
    &lt;input type="submit" value="submit"&gt;
   &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>