I am using the following line in one of my erb files :
<%=@map.div(:width => 800, :height => 500)%>
it output the following HTML :
<div id="map" style="width:800px;height:500px" ></div>
Displayed as : <div id="map" style="width:800px;height:500px" ></div>
in the browser.
EDIT : My only other piece of code is :
require 'rubygems'
include GeoKit::Geocoders
class HomeController < ApplicationController
def index
coordinates =[13.0343841, 80.2502535] #you can get the coordinates for the location you want from http://stevemorse.org/jcal/latlon.php
@map = GMap.new('map')
@map.control_init(:large_map => true, :开发者_StackOverflow社区map_type => true)
@map.center_zoom_init(coordinates,10) # here 10 referes to the zoom level for a map
@map.overlay_init(GMarker.new(coordinates,:title => 'Chennai', :info_window => 'Chennai'))
end
end
Why is it doing it? How can I prevent rails 3 to translate my code in special char?
As far as we didn't know anything about div
method you can try this
<%= @map.div(:width => 800, :height => 500).html_safe %>
Better to add html_safe
to output in div
method
精彩评论