Fix & tidy coffeescript mvc model index template

Fix Incorrect check to ignore index from import
Fix invalid coffeescript syntax
Add missing db variable definition
cool, I'm not familiar with coffeescript... will merge