Eshwar Gouthama wrote in post #1016869:
> Hi Everyone,
>
> After finding these am concatenating all these three like this
>
>    devices = windows_devices.concat(unix_devices)
>    @devices = devices.concat(network_devices)
>
>

@devices = windows_devices + unix_devices + 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.
>
> I tried like this also <%= check_scom_column(device) %> in the view.
> And in helper i provided like this
>
>   def check_scom_column(device)
>     if device.IPAddress
>       return device.IPAddress
>     elsif device.IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F
>       return device.IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F
>     end
>   end
>
> But it is giving me error undefined method `IPAddress' for
> #<BaseManagedEntity:0x492d7d0>
>

if device.respond_to?(:IPAddress)
  device.IPAdress
else
  device.IPAddress_65AC01F1_F20E_CE0D_42CA_B24D1DE49E5F
end

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to