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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 August 2011 09:49, merbivore <eshwardeep-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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.Catch the error and take appropriate action? Even better sort out the database design. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Colin, Thanks for the quick reply. I can''t sort out the database design becoz am pulling the data from SCOM sql server. Could you help me how can i solve this one please. On Aug 16, 1:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 16 August 2011 09:49, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > Catch the error and take appropriate action? Even better sort out the > database design. > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 August 2011 09:58, merbivore <eshwardeep-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: Please don''t top post, it makes it difficult to follow the thread. Insert your reply at appropriate point in previous message. Thanks.> Hi Colin, > > Thanks for the quick reply. I can''t sort out the database design > becoz am pulling the data from SCOM sql server. > Could you help me how can i solve this one please.What about my other suggestion to catch the error? Colin> > On Aug 16, 1:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 16 August 2011 09:49, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >> > 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. >> >> Catch the error and take appropriate action? Even better sort out the >> database design. >> >> Colin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Colin, 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> Please help me Colin. I was struck with this issue from 2 days. On Aug 16, 1:58 pm, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Colin, > > Thanks for the quick reply. I can''t sort out the database design > becoz am pulling the data from SCOM sql server. > Could you help me how can i solve this one please. > > On Aug 16, 1:55 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > On 16 August 2011 09:49, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > 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. > > > Catch the error and take appropriate action? Even better sort out the > > database design. > > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 August 2011 10:05, merbivore <eshwardeep-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Colin, > > 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>As I said, you could catch the error. Though probably respond_to? would be better. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Colin, I didn''t understand what you are saying. Could you tell me clearly what should i do. On Aug 16, 2:21 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 16 August 2011 10:05, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Colin, > > > 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> > > As I said, you could catch the error. Though probably respond_to? > would be better. > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Colin, Thanks a lot. I got the solution. On Aug 16, 2:25 pm, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Colin, > > I didn''t understand what you are saying. Could you tell me clearly > what should i do. > > On Aug 16, 2:21 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > On 16 August 2011 10:05, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Colin, > > > > 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> > > > As I said, you could catch the error. Though probably respond_to? > > would be better. > > > Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 August 2011 10:25, merbivore <eshwardeep-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: The first thing I was saying was not to top post, which you ignored.> Hi Colin, > > I didn''t understand what you are saying. Could you tell me clearly > what should i do. > > On Aug 16, 2:21 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 16 August 2011 10:05, merbivore <eshward...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > Hi Colin, >> >> > 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> >> >> As I said, you could catch the error. Though probably respond_to? >> would be better.What did you find when you googled for ruby catch error and ruby respond_to I see that 7stud has saved you that effort. Perhaps working through some ruby and rails tutorials would be a good idea. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.