Skip to content

Commit

Permalink
Remove undefined fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Guimont committed Nov 9, 2010
1 parent cf57850 commit 8206779
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions public/javascripts/models.js
Expand Up @@ -14,14 +14,21 @@ $(function(){

window.Job = BaseModel.extend({
initialize: function() {
//if(!_.isUndefined("_id")) this.set({id : this.get("_id")});
var attrs = {}
if(_.isUndefined(this.get("company_name"))) attrs["company_name"] = CurrentUser.get("company_name") || "";
if(_.isUndefined(this.get("contact_email"))) attrs["contact_email"] = CurrentUser.get("email");
if(_.isUndefined(this.get("title"))) attrs["title"] = "";
if(_.isUndefined(this.get("city"))) attrs["city"] = "";
if(_.isUndefined(this.get("state"))) attrs["state"] = "";
if(_.isUndefined(this.get("country"))) attrs["country"] = "";
if(_.isUndefined(this.get("short_description"))) attrs["short_description"] = "";
if(_.isUndefined(this.get("description"))) attrs["description"] = "";

this.set(attrs);
}
});

window.User = BaseModel.extend({
initialize: function() {
//if(!_.isUndefined("_id")) this.set({id : this.get("_id")});
},
url: function(){
return "/user"
}
Expand Down

0 comments on commit 8206779

Please sign in to comment.