From 7336c262e395b6ce535d76f5a966ce18047d8314 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 21:51:28 +0800 Subject: [PATCH] fix up user model json output function --- app/models/user.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index cb06f646..16b31872 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,15 +50,16 @@ class User < ActiveRecord::Base end def as_json_for_autocomplete - user = {} - user['id'] = u.id - user['label'] = u.name - user['value'] = u.name - user['profile'] = u.image.url(:sixtyfour) - user['mapCount'] = u.maps.count - user['generation'] = u.generation - user['created_at'] = u.created_at.strftime("%m/%d/%Y") - user['rtype'] = "mapper" + json = {} + json['id'] = id + json['label'] = name + json['value'] = name + json['profile'] = image.url(:sixtyfour) + json['mapCount'] = maps.count + json['generation'] = generation + json['created_at'] = created_at.strftime("%m/%d/%Y") + json['rtype'] = "mapper" + json end #generate a random 8 letter/digit code that they can use to invite people