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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:08:24+00:00 2026-06-08T00:08:24+00:00

I have a complicated web application that has a multi record set on the

  • 0

I have a complicated web application that has a multi record set on the top half of the page and single record details on the bottom half of the page when I select a record and also as part of the lower details portion I have partials that I update with AJAX that are multi record tables from model relationships, but the problem I’m having is when I try doing a loop through a record set and try to get data through the relationships of that record, the record comes back nil. Here’s an example of what I mean.

<table>
<% @file.file_entities.each do |i| %>
  <tr>
    <td id="name"><div><a href="#"><%= truncate("#{i.entity.FirstName} #{i.entity.LastName}", :length => 17) %></a></div></td>
    <td id="position"><select><option>Buyer</option><option>Seller</option><option>Lender</option><option>Referrer</option></select></td>
    <td id="pr"><%= check_box_tag('pr_out', i.PRSent, i.PRSent?) %></td>
    <% if EntityContact.where(:EntityID => i.entity.EntityID).phones_callable.first.inspect == nil -%>
      <td id="phone"><div>NONE</div></td>
    <% else %>
      <td id="phone"><div><%= EntityContact.where(:EntityID => i.EntityID).phones_callable.first.ContactDesc %>: <%= EntityContact.where(:EntityID => i.EntityID).phones_ca>
    <% end %>
  </tr>
<% end %>
</table>

Where I’m using this to get the value in ContactDesc

EntityContact.where(:EntityID => i.EntityID).phones_callable.first.ContactDesc

It’s giving me a nil EntityContact model object, but if I put just the i.EntityID in this loop then it gives me the EntityID and also if I replace i.EntityID with an actual ID in my where clause above then it will return that record just fine. So I think i.EntityID isn’t working in my where clause, but I don’t know why?

  • 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-06-08T00:08:25+00:00Added an answer on June 8, 2026 at 12:08 am

    I figured it out, stupid me didn’t realize that if there wasn’t a record in that relationship, it would throw an exception, so I just added an if statement checking if there existed a record first before pulling data, my bad.

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

Sidebar

Related Questions

I have a highly complicated web site that is under source control and has
We have a web application that is sufficiently complicated that it's hard to accurately
I have a very complicated site built on CSS3 that has html elements 3d-transformed,
Situation I have web application I have class which does complicated mathematics computation Equations
I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which
I have a data-mining application that accesses a web-site to retrieve records on an
I have a simple ASP.NET MVC web application that uses NHibernate with FluentNHibernate's auto
We have a (non-web app) Spring application that throws a NoSuchBeanDefinitionException when running tests
I have a complicated report that I need to draw with GDI+ (I don't
I have this complicated slider that utilizes tons of animation. I'm trying to find

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.