diff --git a/lib/core-generators/model/templates/attribute.template b/lib/core-generators/model/templates/attribute.template index 6814fae7..043c3329 100644 --- a/lib/core-generators/model/templates/attribute.template +++ b/lib/core-generators/model/templates/attribute.template @@ -8,7 +8,24 @@ * */ %> -<%if (lang === 'js') {%> <%= name %>: { type: '<%= type %>' } +<% if (lang === 'js') { %> + <%= name %>: { + <% + if(type.includes(['[',']')) { + type = type.replace('[','').replace(']','').toLowerCase(); + %> + <% if(name[name.length-1] == 's') { %>collection:<% } else { %>model:<% } %> '<%= type %>' + <% } else { %> + type: '<%= type %>' + <% } %> +} <%} else if (lang === 'coffee'){ %> <%=name%>: +<% + if(type.includes(['[',']')) { + type = type.replace('[','').replace(']','').toLowerCase(); +%> + <% if(name[name.length-1] == 's') { %>collection:<% } else { %>model:<% } %> '<%= type %>' + <% } else { %> type: '<%= type %>' + <% } %> <%}%>