首先,這個gem看起來很棒 - 感謝@apneadiving。我希望能夠有一天能夠貢獻 - 一旦我弄清楚如何正確使用它: - \獲取Gmaps4Rails使用MongoMapper
一個可怕的新手問題,我擔心......並且我知道我應該能夠單獨根據它關於Ruby-主義......但我沒能找出我做錯了......
我不能讓過去的這個錯誤:
NoMethodError (undefined method `gmaps4rails_options' for <WaterSupply>...
我已經探討了很多不同的方式來編碼COORDS ,但是我相信這個錯誤只是在acts_as_gmappable
中,而不是「工作」。我的模型是這樣的:
class WaterSupply
include Gmaps4rails::ActsAsGmappable
include MongoMapper::Document
acts_as_gmappable :process_geocoding => false
ensure_index [[:loc, '2d']]
def initialize
puts Gmaps4rails::ActsAsGmappable.inspect
puts "*"*50
end
key :name, String, :required => true
# TODO break this address/geo stuff out into a separate Location class
key :loc, GeoPoint, :default => [40.34962381,-74.75102367]
key :gmaps, Boolean
key :address, String
key :city, String
key :zip, String
key :country, String
def gmaps4rails_address
"#{self.address}, #{self.zip} #{self.city}, #{self.country}"
end
end
任何幫助,將不勝感激。我可以得到一個空白的地圖出現,只是沒有任何模型實例數據:-p
一旦我的東西能夠正常工作,我會添加一個博客文章或一個使用MongoMapper和Gmaps4Rails的wiki頁面!
什麼是完整的錯誤消息? – apneadiving
@apneadiving沒有多少人... NoMethodError(未定義的方法'gmaps4rails_options'爲#<給水:0x00000102a76040>): 應用程序/控制器/ water_supplies_controller.rb:86:在'映射」 –