Ruby on Rails Monday, February 28, 2011

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
would work.

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.

thanks.
Erik

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment