0

我正在尝试使用 gmaps4rails gem 创建一个示例项目:但出现错误:

undefined method `gmaps’ for #
Rails.root: /var/www/brandbk
Application Trace | Framework Trace | Full Trace
app/controllers/locations_controller.rb:46:in `block in create’
app/controllers/locations_controller.rb:45:in `create’
Request
Parameters:
{“utf8″=>”вњ“”,
“authenticity_token”=>”CSpi+VhUe8CtF+4R6zxMEXbB8ofa0QxUF1ntGl+N1Ss=”,
“location”=>{“address”=>”rwr”},
“commit”=>”Create Location”}

像这样:http ://pastebin.com/zGP9Z7vE 谁能帮帮我?

我的模型和控制器是有效的,并且与项目 wiki 上的描述相同。谢谢。

4

1 回答 1

2

它来自这里:

return true if gmaps4rails_options[:check_process] == true && self.send(gmaps4rails_options[:checker]) == true

基本上,如果出现以下情况,这条线会阻止地理编码:

  • 没有要求
  • 或者如果它被请求但尚未完成

所以有两种方法可以摆脱它:

  • 设置check_process为假
  • 为您的模型添加一个名为的布尔列gmaps(这也可以使用方法完成)

这里有更多细节:https ://github.com/apneadiving/Google-Maps-for-Rails/wiki/Model-Customization

于 2011-05-23T21:49:25.440 回答