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

  • Home
  • SEARCH
  • 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 7578419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:25:41+00:00 2026-05-30T17:25:41+00:00

This is a many(proposaltracking)-to-one(partner) relationship. I am getting undefined method ‘reference’ for ProposalTracking:Class error

  • 0

This is a many(proposaltracking)-to-one(partner) relationship.

I am getting undefined method 'reference' for ProposalTracking:Class error with @company.proposalTracking.reference

When I run @company.proposalTracking it returns me the ProposalTracking object.

Here is my model:

class ProposalTracking < ActiveRecord::Base
  set_table_name "Proposal_Tracking"
  belongs_to :partner
end

class Partner < ActiveRecord::Base
  has_many :proposalTracking
end

What I want to get is the attributes of proposalTracking like

@company = Partner.find(params[:id])
@company.proposalTracking.reference

but this results in the error undefined method 'reference' for ProposalTracking:Class

I have read solutions where it is because since it is a one-to-many relation, the partner may have more than one track proposal so I would have to grab the first one using .first but I tried this and it then says

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.reference

Any help would be much appreciated!

  • 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-30T17:25:42+00:00Added an answer on May 30, 2026 at 5:25 pm

    It should be

    class Partner < ActiveRecord::Base
      has_many :proposal_trackings
    end
    

    and you can access it via @company.proposal_trackings. But that’s actually an array of ProposalTracking instances (because of has_many) that you have to iterate over to get each attribute

    @company.proposal_trackings.map(&:reference)

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

Sidebar

Related Questions

I have a class that extends View and overrides the onDraw(Canvas canvas) method. This
We are getting this error on a table in our database: Cannot create a
I've done this many times on 32 bit CentOS and everything went ok without
I've had this problem many times before, and I've never had a solution I
I heard this term many times when I came across some protocol implementations, but
I am not professional programmer so i can not be sure about this.How many
I always have heard this motto from many entrepeneurs: do what you are passionate
I have seen this statement in many of the documention samples, like here This
I've got this plain HTML: Many things are in my room: a bed, a
I've been fighting this problem for many hours now and could really use 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.