not sure on this, it could be a number of things. establish_connection is a class method used by Active Record to establish a connection between your application and the database, using the information you provide in config/database.yml. By default, it's called whenever rails is invoked, even though it really has nothing to do with precompiling assets. Usually, when it throws an error, there's an error somewhere in the database.yml file, but this error almost looks like it's missing the definition for the ActiveRecord class.
It's going to be hard to pinpoint this error without more information. What version of rails are you running and in your config/application.rb file do you have the line require 'rails/all' ?