Fix & tidy coffeescript mvc model index template

Fix Incorrect check to ignore index from import
Fix invalid coffeescript syntax
Add missing db variable definition
http://coffeescript.org/#operators