rake assets:precompile
initializes your app by default, which includes connection to the database.
Inside config/application.rb
you can add this, but see the link below for warnings about it:
config.assets.initialize_on_precompile = false
Rails Guide on Precompiling Assets