I have an app that has been around a while that I’m migrating for
Rails 2.3.8. There have been a lot of interesting issues, but I’m on
the home stretch, but have now run into some very odd errors.
The gist is when I run a task with rake it fails, but when I run the
same code form the console it works fine. The ‘fix’ I devised was to
move my include ModuleNameA, include ModuleNameB, etc to the bottom of
the AR file.
I don’t like this ‘fix’ as I don’t understand it. Before I moved them
the AR object (we will call it Bob) kept throwing undefined method
errors when it was called through the rake invocation. It was invoked
in the rake task, but in another AR object.
So the rake task was running something like Worker.work, and it would
fail as described above. When I run Worker.work from the console it
would pass. Once I moved the includes to the bottom of the file both
Anyone ever seen anything like this? I feel like something
fundamental isn’t correct. Like I have broken something basic to the
functionality and my ‘fix’ is some kind of weird patch.