Forum: Ruby on Rails Objects returned from JOINS

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
77d9a965ffba80bb47a17cbc8633afd4?d=identicon&s=25 GPB (Guest)
on 2007-06-29 13:15
(Received via mailing list)

This is my first Ruby on Rails application so please bear with me.

I have a Find that looks like this:

  :select => ", records.firstname, records.lastname,, departments.department,",
  :order => column_name,
  :joins => "JOIN cities ON = city_id JOIN countries ON = country_id JOIN departments ON =
department_id" )

An it return the following objects:

- !ruby/object:Record
    department: Administration
    city: Lima
    country: Peru
    lastname: Perez
    firstname: Pablo
    id: "5"
- !ruby/object:Record
    department: Information Technology
    city: Lima
    country: Peru
    lastname: Rosas
    firstname: Jaime
    id: "2"

Up to this point all is good.

However, when I try to output these values doing this:

    <td><%=h record.firstname %></td>
    <td><%=h record.lastname %></td>
    <td><%=h %></td>
    <td><%=h %></td>
    <td><%=h record.department %></td>

The fields that come from the Records table are displayed. However,
the fields for City, Country and Department come out as blanks, even
though in the debug output it shows they contain data.

What am I doing wrong?!

Thank you in advance.

This topic is locked and can not be replied to.