I see namespaces for rake tasks that serve the same purpose as directories in the file system: they relate to organization, not encapsulation. Therefore, the database tasks are in db:
the Rails tasks in rails:
etc.
Rake namespaces are not classes, so you need to ask yourself which class you add test_method
when you define it in the Rake namespace. The answer is Object. So, when you click on the second task, Object already has a test_method
method that takes one parameter, and Ruby complains correctly.
The best solution is to make your Rake tasks very thin (like controllers) and put any supporting methods (like test_method
) in some kind of library file somewhere reasonably. The Rake task usually needs to just tweak a bit and then call the library method to do the real work (i.e., the same general layout as the controller).
Summary: put all the real work and hard work somewhere in your library files and make your Rake tasks a thin shell for your libraries. This should make your problem go away through proper code organization.
mu is too short
source share