updated the script to include all possible variables and different rails versions