Pat Maddox
2007-Feb-07 01:59 UTC
ActiveResource: a tag that has the same name as an existing class
I''ve got an ActiveRecord::Base class named Tracker. I''ve also got an ActiveResource class named MyConfig that will read an xml file that looks like: <my-config> <tracker> <name>foo</name> </tracker> </my-config> class MyConfig < ActiveResource::Base self.site = "http://localhost" end If I do MyConfig.find(1), I get: NoMethodError: undefined method `name='' for #<Tracker:0x2487378> ARes apparently creates new classes for all these sub-elements, and it does them in the MyConfig context (so it should make MyConfig::Tracker). If I type MyConfig::Tracker into the console, I get>> MyConfig::Tracker(irb):13: warning: toplevel constant Tracker referenced by MyConfig::Tracker => Tracker Why is it doing this? And how do I fix it? I need to keep my Tracker ActiveRecord class, and the xml file has to have the <tracker> element. Pat --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---