On Thu, Mar 12, 2009 at 4:28 PM, simon <[email protected]> wrote: > > Hi all, > > I've just wasted a day fixing an issue that IMO shouldn't be one. I've > got a workaround, but it smells as there's more, and I would greatly > appreciate pointers what to watch out for. > > The issue: I've got a model, and it had a method 'all_noload'. It's > homebrew, i.e. doesnt' derive from ActiveRecord::Base. all_noload > simply enumerated a directory and made model objects of it. > > Now in production, it didn't work any more. Instead on an array, I got > []. But not in development or test, i.e. it worked fine in them. Even > the precise code of all_noload, in the rails console, worked fine in > all environments. > > The 'fix' is to rename the method. Apparently it is related to > ActiveRecord initialization,
This makes no sense since you just said your model "doesnt' derive from ActiveRecord::Base" above. > So, I suspect some rails magic is applied here with overly optimistic > assumptions. If you use Rails you have to deal with it's chosen name spaces. Why would you think it'd be any other way? > So, is there a semi-official list of forbidden names in models or > something? You can easily check what's already there before making your own class or method: ObjectSpace.const_defined?( 'Foo' ) ActiveRecord::Base.respond_to?( 'all_noload' ) -- Greg Donald http://destiney.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 [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 -~----------~----~----~----~------~----~------~--~---

