-<script type="text/javascript">
- var nearest = [], friends = [];
- <% friends = @user.friends.collect { |f| f.befriendee } %>
- <% friends.each do |friend| %>
- <% if !friend.home_lat.nil? and !friend.home_lon.nil? %>
- friends.push({
- display_name : "<%= escape_javascript(friend.display_name) %>",
- home_lat : <%= friend.home_lat %>,
- home_lon : <%= friend.home_lon %>
- });
- <% end %>
- <% end %>
- <% nearest = @user.nearby - friends %>
- <% nearest.each do |nearby| %>
- nearest.push({
- display_name : "<%= escape_javascript(nearby.display_name) %>",
- home_lat : <%= nearby.home_lat %>,
- home_lon : <%= nearby.home_lon %>
- });
- <% end %>
-</script>
+<% friends = @user.friends.collect { |f| f.befriendee }.select { |f| !f.home_lat.nil? and !f.home_lon.nil? } %>
+<% nearest = @user.nearby - friends %>