Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:17:28+00:00 2026-05-31T00:17:28+00:00

[Edit: The solution to this problem is in the routes.rb file. I have resource

  • 0

[Edit: The solution to this problem is in the routes.rb file. I have “resource” instead of “resources” on the “:comments” line]

I’m following the guide at http://guides.rubyonrails.org/getting_started.html, and I’m at section 9 “Deleting Comments”. I’ve been following the guide step-by-step, and have been cutting/pasting the code instead of typing it, so I doubt I have a typo – more like I missed a step. I’d like to fix this before continuing with the tutorial as I’m brand-spanking-new to Rails and it’s still pretty foreign to me.

Any idea what’s wrong?

An except from my routes.rb:

  resources :posts do
    resource :comments
  end

When I attempt to view a post with a comment, I receive the following error:

NoMethodError in Posts#show

Showing C:/Documents and Settings/stevez/Desktop/blog/app/views/comments/_comment.html.erb where line #12 raised:

undefined method `post_comment_path' for #<#<Class:0x1f13238>:0x1eecf70>
Extracted source (around line #12):

9: </p>
10: 
11: <p>
12:   <%= link_to 'Destroy Comment', [comment.post, comment],
13:                :confirm => 'Are you sure?',
14:                :method => :delete %>
15: </p>
Trace of template inclusion: app/views/posts/show.html.erb

Rails.root: C:/Documents and Settings/stevez/Desktop/blog

Application Trace | Framework Trace | Full Trace
app/views/comments/_comment.html.erb:12:in `_app_views_comments__comment_html_erb___131033543_18407100'
app/views/posts/show.html.erb:19:in `_app_views_posts_show_html_erb___843714715_14332200'
app/controllers/posts_controller.rb:18:in `show'
Request

Parameters:

{"id"=>"2"}
Show session dump

Show env dump

GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_CHARSET: "ISO-8859-1,utf-8;q=0.7,*;q=0.3"
HTTP_ACCEPT_ENCODING: "gzip,deflate,sdch"
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8"
HTTP_CACHE_CONTROL: "max-age=0"
REMOTE_ADDR: "127.0.0.1"
REMOTE_HOST: "localhost"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"
Response

Headers:

None
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:17:29+00:00Added an answer on May 31, 2026 at 12:17 am

    In your routes, the routing to comments should be plural as well, meaning resources instead of resource. Try to do it like this:

    resources :posts do
      resources :comments
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Intro: EDIT: See solution at the bottom of this question (c++) I have a
EDIT: I finally found a real simple solution to this problem, using the CAGradientLayer
I'm looking for a solution for this problem in C or C++. edit :
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
My current solution will suck sometimes EDIT For those who don't understand,see this example:
This is a theoretical question, I've already got a solution to my problem that
I'm looking for an elegant pattern to solve this problem: I have several user
I've spent a good amount of time coming up with solution to this problem,
Been searching all around but still cannot find a solution for this problem. My
In config/routes.rb: resources :posts do resources :comments end resources :pictures do resources :comments end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.