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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:09:39+00:00 2026-05-16T03:09:39+00:00

I am building a group blog that is moderated by the community. When a

  • 0

I am building a group blog that is moderated by the community. When a user visits the moderate page, he is served up a random post that he has not yet moderated, and asked whether or not the post should appear.

So, the relevant objects are Post, User, and Moderation. A Moderation has a post_id and a user_id. I want to find a post from the set Post.all where there does not exist a Moderation object corresponding to that post and the current user.

What’s the most efficient way of doing this? I could get all of the moderations for that user, and then use map to get all of the posts that the user moderated, and then query the posts database as (pseudocode) Post.find(:conditions => "id != [list of posts already moderated]) but I’m worried that might be slow? Is there a faster way?

Also, would it be a good idea to cache this somehow? Maybe by getting all posts that haven’t been moderated, and saving that somewhere, and then when future calls to the moderate method are made, check that cache first and serve up a post (and remove that post from the cache), and only checking again for more posts if the cache is empty?

Thanks for your help!

  • 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-16T03:09:40+00:00Added an answer on May 16, 2026 at 3:09 am

    Just off top of my head:

    Post.all(:joins => 'LEFT OUTER JOIN moderations m ON p.id=m.post_id AND m.user_id != #{id}')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm building a website that has a prices page in it that lists
Building a website that has English & Japanese speaking users, with the Japanese users
I'm building a one page form that will create a model and it's relations.
I'm building an application that needs to use the Linux group keyring to share
Our group is building a process modelling application that simulates an industrial process. The
I am building a small website that has a fairly large amount of pictures
I'm building a query with a GROUP BY clause that needs the ability to
I'm building a Rails app that includes live group chat. I've heard Juggernaut is
I'm building an app for a group of three different societies. Each society of
I'm building a PHP calendar app for a photography group. They need to be

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.