Found this post Include namespace in Rails 3.1 console but it doesn’t seem to work.
The following lib/task defined and it works from the command line: rake namespace_name:task_name.
How to call a method method_name in namespace_name from within the console, without calling the task?
rails console
namespace_name::task_name
NameError: undefined local variable or method 'namespace_name' for main:Object
irb namespace_name
NameError: undefined local variable or method 'namespace_name' for main:Object
Working in Rails 3.07, Ubuntu.
If you want to call a method defined inside a
.rakefile you do something similar to what @Nate said, but instead of calling the raketask, call the method:It feels kind of strange that you don’t need to specify the namespaces but I just tried this and it worked.