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

  • Home
  • SEARCH
  • 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 6591841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:28:39+00:00 2026-05-25T17:28:39+00:00

OK, Ive built a status feed for this site Im making which shows a

  • 0

OK, Ive built a status feed for this site Im making which shows a user the recently added artwork of a user they are following. I have another feed that shows recently added comments by the followed user, which will soon be changed to comments added to the current user’s submitted work.

Anyway, I was wondering how to go about merging the two arrays into the same feed. So that way the feed will display both arrays, in order of created by.

Im thinking that in my model (where my feed is defined, see below), I would call the two queries, then add them together, then sort by created_at.

And in the view I would loop through the array, and use an if/else statement to correctly display the activity.

How would I go about actually merging and sorting the arrays?

edit – I should point out that my feed is defined in the my user model as

  def feed
    Image.followed_by(self.id)
    Comment.followed_by(self.id)
  end
  • 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-25T17:28:39+00:00Added an answer on May 25, 2026 at 5:28 pm

    You could add the two arrays together and then sort by created_at like this:(array1 + array2).sort_by(&:created_at)

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

Sidebar

Related Questions

I've built a small application which has User Management, a frontend console to enter
I've built web apps before that utilize phpBB session, and user data. The common
I've built a static library, to be linked in my iPhone apps. This library
I've installed Haskell via the pre built installer v6.8.2. When trying to compile this
I've built a ASP.NET webforms site for a customer, and lately the customer has
I'm trying to append the following table built up in a string to a
I've built a new SharePoint 2010 Web Site. My authantication type is Claims Based
I've built a windows service application using Visual Studio .NET and C#. This service
I've built an activity that uses this implementation (see the accepted answer) to post
I run a small e-commerce site that over the last few years has built

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.