title: Rails: if statement in .map()
body: <p>I want to map some values from a table to an array. Works fine, except for the fact that the database has some <code>nil</code> values in it, which creates invalid JSON. So far I have this:</p>
  
  <pre><code>@markers = ExtendedProfile.all.map{|u|[u.city, u.latitude, u.longitude]}
  </code></pre>
  
  <p>Now what I want to do is check if the fields are filled in, and if not, enter a default value. So for example <code>if u.latitude == nil</code> I want to enter <code>0.0</code> in the array, instead of <code>nil</code>. Any idea about how to accomplish this?</p>