Hey, namespace collisions can be troubling, but I'm confused. You said
you made a method on a non-activerecord model but then you said it
worked once you removed the db definition.
Yes, exactly. That's the irony. The only way to get it working _in
production_ (or test, as I discovered now)
is to have no DB definition. Even though I don't derive from
activerecord.
That's rails 2.2.2, on 2 different machines so far. I've got a gem in,
authlogic.
By 'in production', I mean either:
RAILS_ENV=production script/console
Or the same with server (thin), getting no listing in html
What was the name of your model, and did you define a class method or
an instance method? Did you have other plugins installed?
It's a class method. Named all_noload, it returns . I suspect it
doesn't get called at all (I issued a print).
Named 'humptydumpty', it works fine, as it does in development or
test. Textually, both are the same
except the name behind def.
Before you go too much farther, make a brand new Rails app and
duplicate the behavior there. If you can reproduce it, then it's
either something with names or something goofy in your code. Can you
write a test that reproduces that behavior?
Unfortunately, no. I couldn't reproduce in a brand new app .
Also can you tell us more about your production environment? You said
it works in all environments through the console, so now I wonder if
No, that's not what I meant. Console is in line with the running
instance,
i.e. it works or not depending on environment. I tried to see if it's
a function
of the DB backend (prod uses mysql, dev is sqlite), but no luck.
you're running it through apache and trying to enumerate a dir that
the user has no access to on the file system.
That's what I thought too, but the humtydumpty test shows it's a names
problem.
Are there known-good ways to deal with this class of problems? Greg's
suggestion is fine
but didn't get me far, especially since I don't derive from
ActiveRecord::Base.
For now, all_kingkong works, but I'd feel safer knowing what is going
on.