Add dependent field to Mongoid's output
<p>I have two models:</p>

<pre><code>class City
  include Mongoid::Document

  field :alternate_names, type: String
  field :coordinates, type: Array
  field :name, type: String

  index({ coordinates: '2d' }, { min: -180, max: 180 })

  belongs_to :country
end
</code></pre>

<p>and</p>

<pre><code>class Country
  include Mongoid::Document

  field :iso_3166_code, type: String
  field :name, type: String

  has_many :cities
end
</code></pre>

<p>In the controller I use</p>

<p><code>@cities = City.where(alternate_names: /#{params[:query].downcase}/).limit(10)</code></p>

<p>to receive cities list.</p>

<p>Here is an JSON output for each city:</p>

<pre><code>...

"country_id": {
  "$oid": "56fc453eae3bbe5c2abcd933"
}

...
</code></pre>

<p>How can I get <code>country</code> instead of it's <code>country_id</code>?</p>