GMaps4Rails 显示地图,但没有地方可以创建位置

发布于 2024-11-03 09:53:45 字数 685 浏览 0 评论 0原文

我正在使用 gmaps4Rails gem,我按照说明进行操作,并且得到了 有地图,但没有“新位置”按钮。

我已经看了 4 遍 YouTube 视频,它显示您不必创建表单或任何东西,它都是为您创建的。
这是我的服务器输出

  Rendered /usr/lib/ruby/gems/1.8/gems/gmaps4rails-0.7.7/app/views/gmaps4rails/_gmaps4rails.html.erb (2.6ms)
  Rendered layouts/_stylesheets.html.erb (1.5ms)
  Rendered layouts/_header.html.erb (5.5ms)
  Rendered layouts/_footer.html.erb (0.7ms)

我已经阅读了所有维基并找到了自定义标记的方法,但我不想要这样。
我只想向地图添加 1 个标记。
我还尝试将 .css 和 .js 文件添加到我的应用程序中,但没有显示任何内容。

它在本地主机上不起作用吗?
或者是因为我试图在另一个对象的创建中创建位置?

我也尝试过这个:

      <%= f.text_field :address %>

但它抛出一个“您必须提供一个地址”在创建它之前出错。

Im using the gmaps4Rails gem and I followed the instructions and am getting
a map but no "new location" button.

I've watched the youtube video like 4 times and it shows on there that you don't have to create a form or anything, its all created for you.

This is my server output

  Rendered /usr/lib/ruby/gems/1.8/gems/gmaps4rails-0.7.7/app/views/gmaps4rails/_gmaps4rails.html.erb (2.6ms)
  Rendered layouts/_stylesheets.html.erb (1.5ms)
  Rendered layouts/_header.html.erb (5.5ms)
  Rendered layouts/_footer.html.erb (0.7ms)

I've read through all the wiki's and I found ways to customize the markers, but I don't want that.
I just want to be able to add 1 marker to the map.
I also tried adding the .css and .js files to my app and then nothing showed up.

Does it not work on localhost ?
Or is it because I'm trying to create the location inside the creation of another object?

I've tried just this too:

      <%= f.text_field :address %>

But it throws a "You must provide an address" error before it creates it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笔芯 2024-11-10 09:53:45

在截屏视频中,我使用了一个脚手架生成器,它在视频开头为我构建了表单(整个应用程序是从头开始制作的),

rails g scaffold Character name:string address:string longitude:float latitude:float gmaps:boolean

如果您不使用它,您需要自己创建迁移和控制器操作+视图。

我强烈建议您查看 http://railsforzombies.org 来了解 Rails 的基础知识。

In the screencast, I use a scaffold generator which builds the form for me at the beginning of the video (the whole app is made from scratch)

rails g scaffold Character name:string address:string longitude:float latitude:float gmaps:boolean

You need to create your migration and controller action + views yourself if you don't use it.

I really suggest you have a look at http://railsforzombies.org to learn the basics of Rails.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文