Your conflating the defining of code and the execution of code.

I would strongly recommend not making it so simply requiring a file populates a database. Instead, have this file define a method you can use to populate the database; then call that method in your rake task.