2 萤火虫中显示的错误
ReferenceError: Gmaps4Rails is not defined
})(Gmaps4Rails);
ReferenceError: Gmaps4RailsGoogle is not defined
Gmaps.map = new Gmaps4RailsGoogle();
应用程序.html.erb
<%= javascript_include_tag "gmaps4rails/gmaps4rails.googlemaps" %>
<%= javascript_include_tag "gmaps4rails/gmaps4rails.base" %>
<%= javascript_include_tag "gmaps4rails/gmaps4rails.bing" %>
<%= javascript_include_tag "gmaps4rails/gmaps4rails.mapquest" %>
<%= javascript_include_tag "gmaps4rails/gmaps4rails.openlayers" %>
<body>
<%= yield %>
<%= yield :scripts %>
</body>
propertymap.rb(模型)
attr_accessible :title, :place, :prop_details
acts_as_gmappable #:process_geocoding => false (if custom lang and longi tudes)
def gmaps4rails_address
"#{self.title}, #{self.place}"
end
property_map_controller.rb
def index
@properties = PropertyMap.all
@json = PropertyMap.all.to_gmaps4rails
end
看法
<%= gmaps4rails(@json) %>
空盒子出现在视图中,里面没有任何东西