I am trying to make a custom rake
task, but I cannot seem to get it working. My code looks like this:
namespace :demotask do
desc "display the current environment of rake"
task :current_environment => :environment do
puts "You are running rake task in #{Rails.env} environment"
end
end
and is placed in a file named test.rake
under lib/tasks
. The Rakefile
is there, but I do get this error when running the task in the console:
NameError: undefined local variable or method 'current_environment' for main:Object
I tried to restart the server as well.