0

githubの指示に従って、すべてをインストールしました。(Gmaps4Rails-github

問題は、マップが空白であるということです。cssからマップの境界線しか見えません。

モデル:

class Recipe
  include Mongoid::Document
  include Gmaps4rails::ActsAsGmappable
  acts_as_gmappable 

  field :name, :type => String
  field :city, :type => String
  field :country, :type => String
  field :latitude, :type => Float
  field :longitude, :type => Float
  field :gmaps, :type => Boolean

  def gmaps4rails_address
    "#{self.city}, #{self.country}" 
  end
end

コントローラ:

class RecipesController < ApplicationController
  def index
   @location = Recipe.all.to_gmaps4rails
  end
end

意見:

= gmaps4rails(@location)

@locationには、次のような配列にlatとlngがあります。

[{"lat":13.055363,"lng":47.811886},{"lat":13.055363,"lng":47.811886}]

必要なJSファイルとCSSファイルが読み込まれています:gmaps4rails.base.js、gmaps4rails.googlemaps.js、gmaps4rails.bing.js、gmaps4rails.mapquest.js、gmaps4rails.openlayers.js、gmaps4rails.css

サーバーログまたはJSコンソールにエラーが表示されません。ここで何が間違っているのかわかりません。

どんな提案も本当に役に立ちます!ありがとう!

4

1 に答える 1

1

私は次の言及を見ることができません:

<%= yield :scripts %>

ここにあなたのコードで。ただし、これは必須です。

于 2012-05-22T16:37:14.043 に答える