title: Delete path error
body: <p>I am trying to add a delete post option. I don't really know what I did wrong, I never had this error before. It keeps on telling me that no routes matches delete. Is it maybe because it thinks that the delete button is for deleting the user instead of the post? </p>
  
  <pre><code>No route matches [DELETE] "/users/***"
  </code></pre>
  
  <p>My code for the post view</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;% for @p in @posts %&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-3"&gt;
              &lt;p&gt;&lt;%= @p.content %&gt;&lt;/p&gt;
              &lt;p&gt;&lt;%= current_user.username %&gt;&lt;/p&gt;
              &lt;%= link_to "delete", @p_path, method: :delete,
                                    data: { confirm: "You sure?" } %&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;% end %&gt;
  &lt;/div&gt;
  
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-5"&gt;
              &lt;%= render '/components/post_form' %&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Code in controller</p>
  
  <pre><code>class PostsController &lt; ApplicationController
      #new post
      def new
          @post = Post.new
      end
      #create post
      def create
          @post = Post.new(posts_params)
          @post.user_id = current_user.id
          respond_to do |f|
              if (@post.save)
                  f.html {redirect_to "", notice: "Succesfully posted."}
              else
                  f.html {redirect_to "", notice: "An error happened while submitting your post. Please try again."}
              end         
          end
      end
      #show post 
      def show
          if (User.find_by_username(params[:id]))
              @post = params[:id]
          end
      end
      #destroy post
      def destroy
          @post.destroy
          redirect_to root_path
      end
      #private
      private
          def posts_params
              params.require(:post).permit(:user_id, :content)
          end
  
  end
  </code></pre>
  
  <p>Code in routes</p>
  
  <pre><code>Rails.application.routes.draw do
  
    devise_for :users
    # default page redirect
    root 'pages#index'
    #other pages
    get 'home' =&gt; 'pages#home'
    get '/users/:id' =&gt; 'pages#profile'
    get 'explore' =&gt; 'pages#explore'
    #form resources
    resources :posts
  
  end
  </code></pre>