Hi Everyone,

   I am trying to solve this problem, but couldn't able to get the
solution. I hope i will get some help here.

I am using these three find methods to get different types of
devices.  I dont have any relationships between any models.


  windows_devices = BaseManagedEntity.find(:all,
  :select => "b.BaseManagedEntityInternalId, c.NetworkName,
c.IPAddress, s.HealthState, s.LastModified",
  :joins =>  "as b INNER JOIN mt_computer as c ON
c.basemanagedentityid = b.basemanagedentityid
        INNER JOIN state as s ON b.basemanagedentityid =
s.basemanagedentityid",
  :conditions => "IsManaged = 1 and s.LastModified = (select
MAX(LastModified) from state where basemanagedentityid =
s.basemanagedentityid)",
  :order => "s.LastModified DESC",
  :group => "b.BaseManagedEntityInternalId, s.HealthState,
s.LastModified, c.NetworkName, c.IPAddress" )

  unix_devices = BaseManagedEntity.find(:all,
  :select => "b.BaseManagedEntityInternalId,
c.NetworkName_360E5A02_BC9E_0000_2614_1972E304088A,
c.IPAddress_360E5A02_BC9E_0000_2614_1972E304088A, s.HealthState,
s.LastModified",
  :joins =>  "as b INNER JOIN MTV_Computer_0 as c ON
c.basemanagedentityid = b.basemanagedentityid
        INNER JOIN state as s ON b.basemanagedentityid =
s.basemanagedentityid",
  :conditions => "IsManaged = 1 and s.LastModified = (select
MAX(LastModified) from state where basemanagedentityid =
s.basemanagedentityid)",
  :order => "s.LastModified DESC",
  :group => "b.BaseManagedEntityInternalId, s.HealthState,
s.LastModified, c.NetworkName_360E5A02_BC9E_0000_2614_1972E304088A,
c.IPAddress_360E5A02_BC9E_0000_2614_1972E304088A" )

  network_devices = BaseManagedEntity.find(:all,
  :select => "b.BaseManagedEntityInternalId,
c.Name_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F,
c.IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F, s.HealthState,
s.LastModified",
  :joins =>  "as b INNER JOIN mt_networkdevice as c ON
c.basemanagedentityid = b.basemanagedentityid
        INNER JOIN state as s ON b.basemanagedentityid =
s.basemanagedentityid",
  :conditions => "IsManaged = 1 and s.LastModified = (select
MAX(LastModified) from state where basemanagedentityid =
s.basemanagedentityid)",
  :order => "s.LastModified DESC",
  :group => "b.BaseManagedEntityInternalId, s.HealthState,
s.LastModified, c.Name_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F,
c.IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F" )

After finding these am concatenating all these three like this

   devices = windows_devices.concat(unix_devices)
   @devices = devices.concat(network_devices)


I need to loop @devices in the view and i need to display the IP
Address for the all the devices.

When i do <%= device.IPAddress %> am getting error because the other
device uses the attribute
IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F .

I was struck with this issue. Please help me in this issue asap.




-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to