If you want to run you rake task without passing the environment variable in the command line argument.
Use Case: The task runs only in production and it needs to be automated.However, we need to pass a command line variable for the task to run.
Following is the task:
The command used to run the task is as follows :
We can achieve this by writing another rake task that passes the environment variable to the respective task(s). In case there are a bunch of other tasks you can define them all under the same task.
Or you can make a direct command call:
The issue with the second approach is that it will spawn a lot of rake tasks, so the first approach seems better.