Undefined methods in Links#Show Rails
<p>I want to make button Destroy in rails app, but it shows the comment </p>

<pre><code>    undefined method `comment_path' for #&lt;#&lt;Class:0x007fe0566264c8&gt;:0x007fe05a5df3f8&gt;
    Did you mean?  font_path
</code></pre>

<p>While I don't have font_path, and when I get rid of this pseudocode, the problem is gone but I can't destroy comment.</p>

<pre><code>  &lt;% if comment.user == current_user -%&gt;
            &lt;%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-sm btn-default" %&gt;
        &lt;% end %&gt;
</code></pre>

<p>If I get rid of this, the problem is gone, but I can't delete the comment. If I put the @ symbol before comment in 'Destroy', it's not the comment that will be deleted, but the post. Here's the full code:</p>

<pre><code>&lt;%= div_for(comment) do %&gt;
&lt;div class="comments_wrapper clearfix"&gt;
    &lt;div class="pull-left"&gt;
        &lt;p class="lead"&gt;&lt;%= comment.body %&gt;&lt;/p&gt;
        &lt;p&gt;&lt;small&gt;Submitted &lt;strong&gt;&lt;%= time_ago_in_words(comment.created_at) %&gt; ago&lt;/strong&gt; by &lt;%= comment.user.email %&gt;&lt;/small&gt;&lt;/p&gt;
    &lt;/div&gt;

    &lt;div class="btn-group pull-right"&gt;
  &lt;% if comment.user == current_user -%&gt;
            &lt;%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-sm btn-default" %&gt;
        &lt;% end %&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>



<p>This is my routes.rb code</p>

<pre><code>    Rails.application.routes.draw do
  devise_for :users
  resources :links do
    member do
      put "like", to: "links#upvote"
      put "dislike", to: "links#downvote"
    end
    resources :comments
  end

  root to: "links#index"
  # The priority is based upon order of creation: first created -&gt; highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'

  # Example of regular route:
  #   get 'products/:id' =&gt; 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' =&gt; 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end
</code></pre>

<p>Thank you for your help!</p>