I have a variable inside application.html.erb
's <script>
:
...
<script>
...
pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
...
</script>
Is there a way to pass it down to one of my controllers (posts_controller.rb
)'s method (some_method
)?
I need to get both latitude and longitude that is generated inside the script into posts_controller
. How can I do this?
EDIT: (I didn't mention it, but some_method
does not use get 'some_method'
, but post
)
#routes
post 'some_method' => 'posts#scrape', as: :some_method