I am trying to create a simple link to another page in my rails app but it doesnt seem to work.Even though I have configured a route for my posts index page it gives me the following error:

```
No route matches {:action=>"posts", :lat=>5, :controller=>"coordinates"}

```

Here's my Directory structure:

![enter image description here](https://i.stack.imgur.com/cBsFf.png)

My **routes.rb** file

```
HighwayPolice::Application.routes.draw do

resources:posts
resources:coords
resources:coordinates
get 'posts', to: 'posts#index'  
end

```

**../app/views/coordinates/index.html.erb**

```
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCThq7kV6r4-cILKpujZek5e-uZGbGdjkU&sensor=false">
    </script>
    <script type = "text/javascript">
     function initialize()
     {console.log("click");
    var mapOptions = {
    center: new google.maps.LatLng(-34.397, 150.644),
    zoom: 8
    };
    var map = new google.maps.Map(document.getElementById("map-canvas"),
    mapOptions);

google.maps.event.addListener(map, 'click', function(event) {
console.log(event.latLng.k);
});
var test = 3;
$('#Test').val(test);
console.log(test);
var lat = 3
        var lon = 34
        var parsed_data = {location: {lat: lat, lon: lon}}

}

</script>

<h1>Coordinates#index</h1>
<body onload = "initialize()">
<div id="map-canvas" style = "width:500px; height:500px"></div>
<p>Find me in app/views/coordinates/index.html.erb</p>
<% @coordinates.each do |coordinate| %>
<p><%= coordinate.longitude %></p>
<p><%= coordinate.lattitude %></p>
<hr />
<% end %> 
<%= link_to('Save',{:action => 'post', :lat => 5}) %>

```

**posts\_controller.rb**

```
 class PostsController < ApplicationController
    def index

    end
   end

```