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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:34:49+00:00 2026-06-15T03:34:49+00:00

My group model has_many posts, posts have_many comments. When I show the posts on

  • 0

My group model has_many posts, posts have_many comments.

When I show the posts on a group, I want to order by the created at of the most recent comment, if there are any on a post, or by the created_at of the post itself.

So an old post would jump back to the top of the list if it has a new comment.

  • 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-15T03:34:51+00:00Added an answer on June 15, 2026 at 3:34 am

    I would stick to a little different approach: your Comment belongs_to :post and belongs_to accepts :touch option. Set it to true and your Post’s updated_at will be automatically updated on a Comment’s modification. This way you can freely show your posts ordered by their updated_at.

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

Sidebar

Related Questions

I have a group model which has_many article model. And I want to use
I have the following :has_many, :through association for my models: Group Model: has_many :group_users
I have the following model structure: class Group < ActiveRecord::Base has_many :group_products, :dependent =>
model.py: class Tribes(Group): members = models.ManyToManyField(User, related_name='tribes', verbose_name=_('members')) i want to store a number
Is there any way to group the models in django admin interface? I currently
I have a User model that has_many :posts. If I wanted to make a
I have a User and Group model. User has_many Groups and Group belongs_to User
I have Group model that has_many institutions, and schools. class Group has_many :institutions has_many
I have a group model. I want to query a group to see if
I'm performing this query in a controler and the 'Group' model has_many Users @group=

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.