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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:14:14+00:00 2026-05-20T22:14:14+00:00

Let me describe what i want to do: There is a Match model, which

  • 0

Let me describe what i want to do:
There is a Match model, which should have info about what players and what clans attended in it, with division of home players and clan and away players and clan.
That is pretty easy, but there is another model: Summoner. In each match every player has different summoner and I need to do something like this: Match.find(1).players_home.find(1).Summoner.name to extract which summoner played player 1 in home team.
The point is: each player in each match can play with different summoner.
I hope I described it clearly.
Regards.

  • 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-20T22:14:15+00:00Added an answer on May 20, 2026 at 10:14 pm

    I’m not really sure about all your specifications regarding when an association is one or several, but I think something like this could be it:

    class Match
      has_many :participations
      has_many :players, :through => :participations
    end
    
    class Participation
      belongs_to :match
      belongs_to :player
      belongs_to :summoner
    
      # also a team attribute to store either "home" or "away"
      scope :home, where(:team => "home")
      scope :away, where(:team => "away")
    end
    
    class Player
      belongs_to :clan
      has_many :participations
      has_many :matches, :through => :participations
    end
    
    class Summoner
      has_many :participations
    end
    

    In this setup every match has several participations. Every participation belongs to the player that is participating and also belongs to a summoner for that player and match. It can then be utilized perhaps like this:

    In Controller

    @match = Match.find(1)
    @home_participations = @match.participations.home
    @away_participations = @match.participations.away
    

    In View

    <h1>Home Players</h1>
    <% @home_participations.each do |p| %>
      <p>Player: <%= p.player.name %>, Summoned by: <%= p.summoner.name %></p>
    <% end %>
    

    I hope this was at least somewhat what you where going for. Let me know if you are looking for something else.

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

Sidebar

Related Questions

Well this is weird let me describe the scenario I have this mailer define
Thanks for viewing my question. Let me describe the app first. I have a
I have a problem with forwarding to a .jsp page. Let me describe my
Let me first describe my goal: I have created an object with 3 properties:
Let's say I don't have photoshop, but I want to make pattern files (.pat)
Let me describe the system. There are several mobile devices, each independent from each
Let's say that I have a Domain assembly that describes the domain model, and
I have a question about C# generics and delegate: First I describe the general
I have about 50 CGPoint objects that describe something like a path, and I
Let me first describe the picture below: There are two printed papers. The only

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.