title: gmaps4rails display location based on latitude and longitude
body: <p>I am using gmaps4rails with Rails 3.0.9. I would like to add a marker based on the latitude and longitude coordinates to the map, but I can't figure out how should I do it. I managed to use the map with an andress only. Thanks.</p>
  
  <p>The code I'm using:</p>
  
  <p><em>app/models/location.rb</em></p>
  
  <pre><code>class Location &lt; ActiveRecord::Base
    acts_as_gmappable :process_geocoding =&gt; false
  
    def gmaps4rails_address
      "#{self.latitude}, #{self.longitude}"
    end
  end
  </code></pre>
  
  <p>app/controllers/locations_controller.rb</p>
  
  <pre><code>def index
  @json = Location.first.to_gmaps4rails
  
  respond_to do |format|
    format.html
  end
  </code></pre>
  
  <p><em>app/views/locations/index.html.erb</em></p>
  
  <pre><code>&lt;%= gmaps4rails(@json) %&gt;
  </code></pre>
  
  <p>The <code>location</code> model contains the following fields: <code>latitude, longitude, address</code>.</p>
  
  <p>UPDATE: I found the solution after reading one more time project's wiki about markers. The solution is to use custom <code>&lt;%= gmaps %&gt;</code> method. I managed to use it like this:</p>
  
  <pre><code>&lt;%= gmaps({
      "map_options" =&gt; { "type" =&gt; "ROADMAP", "center_longitude" =&gt; 28.9, "center_latitude" =&gt; 47.03, "zoom" =&gt; 12, "auto_adjust" =&gt; true},
      "markers" =&gt; { "data" =&gt; @markers }
      })
      %&gt;
  </code></pre>
  
  <p>In the controller:</p>
  
  <pre><code>@markers = '[
               {"description": "", "title": "", "sidebar": "", "lng": "28.8701", "lat": "47.0345", "picture": "", "width": "", "height": ""},
               {"lng": "28.9", "lat": "47" }
              ]'
  </code></pre>
  
  <p>You can customize these values as you like.</p>