metamaps--metamaps/app/helpers/users_helper.rb
2014-01-28 22:46:58 -05:00

18 lines
380 B
Ruby

module UsersHelper
## this one is for building our custom JSON autocomplete format for typeahead
def autocomplete_user_array_json(users)
temp = []
users.each do |u|
user = {}
user['id'] = u.id
user['label'] = u.name
user['value'] = u.name
user['mapCount'] = u.maps.count
temp.push user
end
return temp
end
end