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

The Archive Base Latest Questions

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

models: entry, comment I want to add comments to an entry in my forum

  • 0

models: entry, comment

I want to add comments to an entry in my forum on the same page where the entry and all belonging comments are listed.

  1. What is the railsway of doing this?

  2. How can I render the “new” template of “comments” on my “show” page of “entries”?

    I tried:

    <% render :template => {:controller => 'comments', :action => 'new'} %>
    

    as well as

    form_for
    
  • 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-12T11:10:52+00:00Added an answer on June 12, 2026 at 11:10 am

    For #2, try pulling out the new comments form into a partial and then rendering that in both the comments/new view and the entries/show view. So both of those would have a line something like:

    <%= render :partial => "comments/form" %> # or whatever you named the partial
    

    As of the past few Rails releases (I don’t remember exactly when this was added), you can just do:

    <%= render "comments/form" %>
    

    I would also ask yourself if there’s any reason to have a separate comments/new page in the first place: will it ever make sense to add a comment that’s not in the context of some entry?

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

Sidebar

Related Questions

I have something like a blog system. Each entry can has comments. Each comment
Can some one help explain the following page to me http://nullege.com/codes/search/zinnia.models.Entry.objects.create How do I
So basically I have two models, Entry and Comment. I have the association setup
class Blog(models.Model): name = models.CharField(max_length=100) class Entry(models.Model): blog = models.ForeignKey(Blog) headline = models.CharField(max_length=255) Is
I have a such model named Foo: class Foo(models.Model): name = models.CharField() entry =
I have two models -- User and Entry -- that are related through a
I want to send ViewData.model to Special action with the last user data entry.
My models: class Entry(models.Model): title = models.CharField(_('Title'), max_length=200) content = models.TextField(_('Content')) created_at = models.DateTimeField(auto_now_add=True)
I have this simple model: class Tag(models.Model): title = models.SlugField() created = models.datetime def
Related models: models.py class Entry(models.Model): ... class EntryView(models.Model): entry = models.ForeignKey(Entry) dt_clicked = models.DateTimeField(auto_now_add=True)

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.