Rails 3谷歌地图 [英] Rails 3 google maps

查看:112
本文介绍了Rails 3谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to create a sample project with gmaps4rails gem: But getting an error:

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 有人可以帮我吗?

Like this: http://pastebin.com/zGP9Z7vE Can anyone help me please?

我的模型和控制器有效,并且与项目Wiki中所述相同. 谢谢.

My models and controllers are valid and same as described on the project wiki. Thanks.

推荐答案

它来自这里:

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

如果出现以下情况,此行基本上可以防止地理编码

Basically this line prevents geocoding if:

  • 不要求
  • 或者如果已请求但尚未完成

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

So two ways to get rid of it:

  • check_process设置为false
  • 在名为gmaps的模型中添加一个布尔列(也可以通过一种方法来完成)
  • set the check_process to false
  • add a boolean column to your model named gmaps (this could be done with a method as well)

此处有更多详细信息: https://github.com /apneadiving/Google-Maps-for-Rails/wiki/Model-Customization

Some more details here: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Model-Customization

这篇关于Rails 3谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆