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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:31:17+00:00 2026-06-15T02:31:17+00:00

Users on my site each have one list, which consists of a different type

  • 0

Users on my site each have one list, which consists of a different type of users. I’m using a has_many through relationship to do this as follows:

List.rb:

class List < ActiveRecord::Base
  belongs_to :company
  has_many :list_applicants
  has_many :applicants, through: :list_applicants
end

Applicant.rb:

class Applicant < ActiveRecord::Base
  has_many :list_applicants
  has_many :lists, through: :list_applicants
end

ListApplicant.rb

class ListApplicant < ActiveRecord::Base
  attr_accessible :applicant_id, :list_id
  belongs_to :applicant
  belongs_to :list
end

Company.rb:

 class Company < ActiveRecord::Base
   has_one :list
 end

When a user adds another user to their list, I’d like to record the date the user is added so they can sort their list of users by date added. What is the best way to do this?

  • 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-15T02:31:18+00:00Added an answer on June 15, 2026 at 2:31 am

    You can use the created_at field of the ListApplicant model if it has one. If not, you may add manually a similar field.

    UPDATE:

    You can access the field by specifying both applicant and list like this:

    @applicant.list_applicants.where(list_id: @list.id).first.created_at
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WooCommerce site which has a custom post type named 'products'. Each
I have a wp-network installed with users that can create pages in each site.
I have an unordered list, which has maybe 30 items. When one of these
I have a while loop and each one displays a <li></li> in a list,
For my site, I have a list of users and a list of events.
I have a list: <li>item one<img src=/assets/img/site/up_arrow.png class=upArrow/><img src=/assets/img/site/down_arrow.png class=downArrow/</li> <li>item two<img src=/assets/img/site/up_arrow.png class=upArrow/><img
Each user of my site has their own profile page, which contains several items
I was trying to install this .htaccess to notify my users of site maintenance.
Users on my site can add nodes of a custom type (let's call it
I have a members site where users are given up to 7 web page

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.