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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:45:19+00:00 2026-05-25T20:45:19+00:00

Consider a model for keeping user id’s of subscribers on a particular comment thread,

  • 0

Consider a model for keeping user id’s of subscribers on a particular comment thread, such that

thread has_many subscribers

where subscribers is of type user.

I feel like generating a new a table for subscribers is overkill. In principle, I’d like to access thread.subscribers to get a list of subscribers- surely there is a ‘lighter’ way?

I’m using Rails 3 with SQLite.

  • 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-25T20:45:20+00:00Added an answer on May 25, 2026 at 8:45 pm

    There are two methods you could use.

    Options One is to use a habtm relationship like:

    class Thread
      has_and_belongs_to_many :users
    end
    

    However personally I would use an additional model, so that should you even need it you can specify stuff about subscriptions:

    class Thread
      has_many :subscriptions
    end
    
    class Subscription
      belongs_to :thread
      belongs_to :user
    end
    

    Generally a useful join model is considered better practice.

    Additionally I wouldn’t really be worrying about how ‘light’ you database schema is. Databases are very good at what they’re good at, and that’s why we let they do it. Encoding this kind of information as a string or the like as other issues and may even be less efficient.

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

Sidebar

Related Questions

consider scenario, User model with name, birth_date fields (here birth_date is optional) inside view
Let's consider this model: A: columns: b_id: type: int notnull: false relations: b: B
Consider a City Model having: def self.search(field, search) if search where(#{field} LIKE ?, %#{search}%)
Consider this sample model: MODEL_CHOICES = ( (uSPAM, uSpam), (uXOUP, uEggsoup), ) (snip) type
Consider the following domain model: Issue - id - List<Comment> Entry - id -
Consider a wiki application. There is a model Page , that has many Revision
Consider a GAE (python) app that lets users comment on songs. The expected number
Consider the following model: class FPModel(models.Model): # The user who created author = models.ForeignKey(auth.models.User,
Consider the Following object model (->> indicates collection): Customer->Orders Orders->>OrderLineItems->Product{Price} The app is focused
Consider for instance my following database model. UserTable(Id, Username) TextContentTable(Id, Name, Description, CreatedByUserId, ModifiedByUserId,

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.