I'm learning rails 4 with this tutorial:
<http://guides.rubyonrails.org/getting_started.html>

Till now I could fix every thing but now there is a problem after I edit a post and then I would like to save it, but it sends me to `localhost:3000/posts.7` (7 is the post id)

When i go over /posts/new and then click the submit button, it works

This is the Error I get.

```
    Routing Error
    No route matches [PATCH] "/posts.7"

    Rails.root: /home/spod/railstutorial/blog
    Application Trace | Framework Trace | Full Trace

    Routes

    Routes match in priority from top to bottom
    Helper  HTTP Verb   Path    Controller#Action
    Path / Url 

    posts_path  GET     /posts(.:format)    posts#index
                POST    /posts(.:format)    posts#create
    new_post_path   GET     /posts/new(.:format)    posts#new
    edit_post_path  GET     /posts/:id/edit(.:format)   posts#edit
    post_path   GET     /posts/:id(.:format)    posts#show
                PATCH   /posts/:id(.:format)    posts#update
                PUT     /posts/:id(.:format)    posts#update
                DELETE  /posts/:id(.:format)    posts#destroy
    root_path   GET     /   welcome#index 

```

here the `posts_controller.rb`

```
class PostsController < ApplicationController

 def terra
 end

 def edit
  @post = Post.find(params[:id])
 end

 def update
  @post = Post.find(params[:id])

  if @post.update(params[:post].permit(:title, :text))
   rederict_to @post
  else
   render 'edit'
  end
 end

 def index
  @posts = Post.all
 end

 def create
   @post = Post.new(params[:post].permit(:title, :text))

   if @post.save
    redirect_to @post
   else
    render 'new'

   end
  end

  private
   def post_params
   params.require(:post).permit(:title, :text)
  end

 end

```

Here is the `edit.html.erb` 

```
<h1>Editing post</h1>

<%= form_for :post, url: posts_path(@post), method: :patch do |f| %>
 <% if @post.errors.any? %>
 <div id="error_explanation">
  <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
  <ul>
   <% @post.errors.full_messages.each do |msg| %>
    <li><%= msg %></li>
   <% end %>
  </ul>
 </div>
 <% end %>

 <p>
  <%= f.label :title %><br>
  <%= f.text_field :title %>
 </p>

 <p>
  <%= f.label :text %><br>
  <%= f.text_area :text %>
 </p>

 <p>
  <%= f.submit %>
 </p>
<% end %>

<% link_to 'Home', posts_path %>

```

and here is the `new.html.erb`

```
 <h1>New Post</h1>

 <%= form_for :post, url: posts_path do |f| %>
  <% if @post.errors.any? %>
  <div id="error_explanation">
   <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being      saved:</h2>
   <ul>
    <% @post.errors.full_messages.each do |msg| %>
     <li><%= msg %></li>
    <% end %>
   </ul>
  </div>
  <% end %>

  <p>
   <%= f.label :title %><br>
   <%= f.text_field :title %>
  </p>

  <p>
   <%= f.label :text %><br>
   <%= f.text_field :text %>
  </p>

  <p>
  </p>
 <% end %>

 <%=link_to 'Home', posts_path %>

```

I hope this is everything you need
Thanks for helbing