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 8410573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:12:47+00:00 2026-06-10T00:12:47+00:00

I am confused on how nested resources should works and how can i access

  • 0

I am confused on how nested resources should works and how can i access them
Here my model in question

event                      eventcomments
id                           id
Title                        body
Content                      event_id
...

Here my route file

resources :events do
  resources :eventcomments
  end
end

Here the relationship

Article
  has_many :eventcomments
Comments
  belongs_to event

But when i am in show.html.erb of events, I can’t have the link to edit the comment. here the rake route produced

edit_event_eventcomment GET    /events/:event_id/eventcomments/:id/edit(.:format) eventcomments#edit

and my link to

<h2>Comments</h2>
<div>
<% @comments.each do |comment| %>
    <div>
      <%= image_tag (comment.customer.avatar).url(:thumb) %>
      <%= comment.customer.incomplete_name %> said: 
      <%= comment.description %>
      <div>Posted: <%= time_ago_in_words(comment.created_at) %></div>
      <% if current_customer.isadmin? %>
        <%= link_to 'Edit', edit_event_eventcomment_path(@event) %>
        <%= link_to 'Destroy', '#' %>
      <% end %>
    </div><br />

Here the error i am getting

NoMethodError in Eventcomments#edit

Showing /home/jean/rail/voyxe/app/views/eventcomments/_form.html.erb where line #1 raised:

undefined method `eventcomment_path' for #<#<Class:0xb5e73d84>:0xb5e7c8f8>
Extracted source (around line #1):

1: <%= form_for(@eventcomment) do |f| %>
2:   <% if @eventcomment.errors.any? %>
3:     <div id="error_explanation">
4:       <h2><%= pluralize(@eventcomment.errors.count, "error") %> prohibited this eventcomment from being saved:</h2>
  • 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-06-10T00:12:49+00:00Added an answer on June 10, 2026 at 12:12 am

    You are only passing an Event instance to the edit_event_eventcomment_path method and you should be passing the Eventcomment instance also.

    Try with edit_event_eventcomment_path(@event, comment)

    Note: Rename your Eventcomment class to EventComment or just Comment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im a little confused about whether should I use a nested Subquery Or JOINS
ok, I've been following: http://railscasts.com/episodes/196-nested-model-form-part-1 Here are the steps I've had to accomplish so
Nested lists in Common Lisp really confused me. Here is the problem: By using
I'm confused about how binding works for statically scoped variables in nested subroutines. proc
confused - given a track uri, I can get one album but possibly more
Confused here... I have two dates which I NSLog to console and get: dates
Very confused here, trying out the yuicompressor on a simple javascript file. My js
I confused when i want to take single pointer and when should i take
Bit confused here, I have an on-demand instance but do I get charged even
Totally confused here. I have a PARENT UIViewController that needs to pass an NSMutableArray

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.