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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:04:24+00:00 2026-05-25T14:04:24+00:00

I have a Transaction class. Each object of this class includes one issuing account,

  • 0

I have a Transaction class. Each object of this class includes one issuing account, one sending account and one receiving account. Each of these is an instance of Account class. In my Transaction table, I have issuer_id, sender_id and receiver_id.

How should I specify relationship between Transaction and Account so that I can call

transaction.issuer
transaction.sender
transaction.receiver

Thank you.

  • 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-25T14:04:24+00:00Added an answer on May 25, 2026 at 2:04 pm

    Use :class_name to specify the class name, when it can’t be guessed from the association name:

    class Transaction
      belongs_to :issuer,   :class_name => 'Account'
      belongs_to :sender,   :class_name => 'Account'
      belongs_to :receiver, :class_name => 'Account'
    end
    
    class Account
      has_many :issued_transactions,   :foreign_key => :issuer,   :class_name => 'Transaction'
      has_many :sent_transactions,     :foreign_key => :sender,   :class_name => 'Transaction'
      has_many :received_transactions, :foreign_key => :receiver, :class_name => 'Transaction'
    end
    

    You can read more in the documentation.

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

Sidebar

Related Questions

I have a declarative table defined like this: class Transaction(Base): __tablename__ = transactions id
I have a User and Transaction class Each Transaction logically belongs to a User
I have next tables Order , Transaction , Payment . Class Order has some
I have a transaction table like so id , name , code , flag
I have a transaction table like so id , name , code , flag
I have a transaction table and I'm looking to generate a dataset to drive
I have the following transaction: SQL inserts a 1 new record into a table
I have 2 Hibernate classes in a Spring-driven Application like these: @Entity public class
I have the following database tables/EF objects public class Transaction { //some other properties
I have a class which is mirror of table. public class Patient { public

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.