显示带有特殊字符代码的html,只需将其用作html即可
||
我在我的erb文件之一中使用以下行:
<%=@map.div(:width => 800, :height => 500)%>
它输出以下HTML:
<div id=\"map\" style=\"width:800px;height:500px\" ></div>
显示为:<div id=\"map\" style=\"width:800px;height:500px\" ></div>
在浏览器中。
编辑:我唯一的另一段代码是:
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, :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
为什么这样做呢?如何防止Rails 3将我的代码转换为特殊字符?
没有找到相关结果
已邀请:
1 个回复
街茬
方法一无所知,您可以尝试一下
最好以
方法将
添加到输出中