1
ロケーションがテーブルに追加されました。しかし、緯度/経度がありません。マップにマーカーは追加されません。 (DOCが告げるよう)gmaps4rails1.5.1-ジオコーディングが機能しない
class Location < ActiveRecord::Base
validates :priority,:addr,:presence=>true
validates :priority,:numericality=>{:greater_than_or_equal_to =>1,:less_than_or_equal_to =>6}
default_scope :order=>'priority'
acts_as_gmappable :lat=>'lat',:lng=>'lng'
def gmaps4rails_address
self.addr
end
def gmaps4rails_infowindow
"<h4>Target priority: #{priority}</h4>" << "<h4>Address: #{addr}</h4>" << "<h4>Latitude: #{lat}</h4>" << "<h4>Longitude: #{lng}</h4>"
end
def gmaps4rails_marker_picture
{
"picture" => "/images/#{priority%7}.jpg",
"width" => "30",
"height" => "30"
}
end
end
ジオコーディングをトリガーする
false
へgmaps
を設定し、この作成またはときにレコードを編集発生しますか?私は再現できません... – apneadiving両方。新しいプロジェクトを作成しようとします。異なる列で。 – Daniel
'user'オブジェクトを保存したとします。 'user.gmaps'の値は何ですか? – apneadiving