I'm using Rails 4.4.1, Ruby 2.1.2, RGeo 0.3.20 and activerecord-mysql2spatial-adapter 0.4.3
My problem is probably very simple since I'm new to both Ruby and Rails, but I could not find anything useful in the web so far.
I want to create a form to insert geo-spatial coordinates in my db, but I don't know how to access the :latlon fields x and y. This is my tentative code:
<h1>Inserimento nuova Città</h1>
<%= form_for @city, url: cities_path do |city| %>
<p>
<%= city.label :name, "Nome"%><br>
<%= city.text_field :name %>
</p>
<p>
<%= city.label :latlon, "Coordinate GPS" %><br>
<%= city.number_field :latlon.x %><br>
<%= city.number_field :latlon.y %><br>
</p>
<% end %>
The error I get when I access the localhost:3000/cities/new url is
undefined method `x' for :latlon:Symbol
Anyone knows how do I create a form to insert the latlon.x and latlon.y data in my db?
<%= city.label :latlon, "Coordinate GPS" %>
` But now to insert a correct value the user has to write POINT(43.11 12.38). I'm still looking for a solution to input the two numbers separatley, without any text 'POINT' – sparviero19 Jun 06 '14 at 14:07<%= city.text_field :latlon %>