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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:36:39+00:00 2026-05-30T18:36:39+00:00

I have the following scenario I am trying to configure in a Ruby on

  • 0

I have the following scenario I am trying to configure in a Ruby on Rails app (warning: I’m a beginner here)…

I have SupportType model that defines different levels of customer support options (Silver, Gold etc) with details about what that support type covers (24/7, business day only etc).

I have another model, Client that contains all of the basic customer information data.

I need to associate a Client to a SupportType (Client Jones has Gold-level support) but can’t understand the “proper” way to set up this relationship. Neither “has_many” or “has_one” seems to apply in this case.

How do I set this up with the goal of being able to display all client details and the support parameters in one view?

TIA!

  • 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-30T18:36:40+00:00Added an answer on May 30, 2026 at 6:36 pm
    class Client < ActiveRecord::Base
      belongs_to :support_type
    end
    
    class SupportType < ActiveRecord::Base
      has_many :clients
    end
    

    This way you can access client’s support type with a_client.support_type and see all the clients having gold support type with gold_support.clients

    You can’t use has_one in the Client model because in that case Rails aspects to find a client_id in the support_types DB table and it’s not the case if I understood well since many clients can have the same SupportType.

    PS: Remember to add a support_type_id column to your clients DB table

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

Sidebar

Related Questions

I am trying to understand isolation/locks in SQL Server. I have following scenario in
Following on from this question...I'm trying to unit test the following scenario: I have
I am trying to implement following scenario in the IPad environment. I have list
I was trying to deploy my project with IExpress. I have the following scenario.
I have the following scenario: in my models.py class FooBar(models.Model): description = models.CharField(max_length=20) in
I have the following scenario downloading a file form sever: I am trying to
I'm trying to put together an app for fun that has a scenario where
I am trying to find records that has the following scenario. ID | name
I'm trying to improve my coding style. Consider the following scenario: Suppose that I
I am trying get the Regex right for the following scenario but have some

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.