Noah Stern
2006-Sep-09 00:08 UTC
Get undefined method when trying to invoke a class in my lib
I have an application to generate a metrics chart online. My controller has a snippet like this: def generate_metrics_graph ... ts = TelnetServer.new ts.buildtimearray("2006-09-07-05-00") ... end telnet_server.rb has the method like so: Class TelnetServer ... ... def buildtimearray(starttime) ... ... end ... ... end Whenever I click on my button to execute generate_metrics_graph I get this: undefined method `buildtimearray'' for #<TelnetServer:0x38fbc00> I think I''m missing something obvious here, but I don''t know what it is. Any help would be greatly appreciated. Thx Noah -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Tamim Azizadah
2006-Sep-09 00:38 UTC
Re: Get undefined method when trying to invoke a class in my lib
Where in your application are you including telnet_server.rb? Seems like it might not be included in your code so it can''t access the method. Noah Stern wrote:> I have an application to generate a metrics chart online. > > My controller has a snippet like this: > > def generate_metrics_graph > ... > ts = TelnetServer.new > ts.buildtimearray("2006-09-07-05-00") > ... > end > > telnet_server.rb has the method like so: > Class TelnetServer > ... > ... > def buildtimearray(starttime) > ... > ... > end > ... > ... > end > > Whenever I click on my button to execute generate_metrics_graph > > I get this: undefined method `buildtimearray'' for > #<TelnetServer:0x38fbc00> > > I think I''m missing something obvious here, but I don''t know what it is. > Any help would be greatly appreciated. > > Thx > Noah > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Tamim Azizadah wrote:> Where in your application are you including telnet_server.rb? Seems like > it might not be included in your code so it can''t access the method.I have a require "telnet_server" at the top of my controller. It seems to instantiate the class okay. When I do tsmethods = ts.methods and then tsmethods.each {|tsmethod| puts tsmethod} none of my methods appear in the list. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---