I want to use this code to run rake task:

```
task :backup_and_delete_old_data => :environment do
      if defined?(Rails)
        require Rails.root + '/config/boot'
      else
        require '../../../config/boot'
      end
      require Rails.root + '/config/environment'

      factory_backup.each do |factory_data|
        puts ">> Backup and delete old #{factory_data.to_s.pluralize.humanize} data..."
        factory_data.factory_backup(backup_and_delete_old_data)
      end
    end

```

But when I run the rake task I get error:

```
TypeError: no implicit conversion of Pathname into String

```

for this line:

```
require Rails.root + '/config/boot'

```

Do you know how I can fix this issue?