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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:17:41+00:00 2026-05-26T10:17:41+00:00

First here’s my current setup: models/user.rb class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable,

  • 0

First here’s my current setup:

models/user.rb

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :confirmable
   has_many :events
end

models/event.rb

class Event < ActiveRecord::Base
  belongs_to :user
end

So, this works in the sense that a user have many events that s/he can CRUD. Anyone that is not logged in can only view and list all the events.

From this initial setup, I now have another set of users that are attendees and the current users are now actually event managers instead of just a generic user. Essentially, I now have two models that are both users (since they can both log in/sign up and have the same fields) and I was thinking that event should read something like:

models/event.rb

class Event < ActiveRecord::Base
  belongs_to :manager
  has_many :attendees, :through => :attendance # attendance is a join model
end

but I don’t want to create a separate table for managers and attendees and I was thinking of sub classing the user model but I’m not particularly sure about how to go about it. I was looking into the :as and :polymorphic parameters in AR but I’m still not quite sure on how to do it. 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-26T10:17:42+00:00Added an answer on May 26, 2026 at 10:17 am

    What you are looking for is called Single Table Inheritance. Here is one resource on the subject. There are many more. Just google for “Rails Single Table Inheritance”.

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

Sidebar

Related Questions

Setup Using MVC 3 + Code First Here are my classes public class Member
First here's what I'm using and trying to do: the minimal setup for this
First question here. I am trying to instantiate a generic class using the type
first here is my html demo code <div class=wrapper> <div class=item></div> <div class=item></div> <div
first here is my html code: <div class=outter> <div class=item></div> <div class=item></div> <div class=item></div>
My first question here... I want to use an abstract class A from which
first question here. I'm developing a program in C# (.NET 3.5) that displays files
First post here... I normally develop using PHP and Symfony with Propel and ActionScript
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
First question here: it is a very short yet fundamental thing in Java that

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.