Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Created October 31, 2008 17:17
Show Gist options
  • Save NZKoz/21353 to your computer and use it in GitHub Desktop.
Save NZKoz/21353 to your computer and use it in GitHub Desktop.
begin
require_library_or_gem 'pg'
rescue LoadError => e
begin
require_library_or_gem 'postgres'
class PGresult
alias_method :nfields, :num_fields unless self.method_defined?(:nfields)
alias_method :ntuples, :num_tuples unless self.method_defined?(:ntuples)
alias_method :ftype, :type unless self.method_defined?(:ftype)
alias_method :cmd_tuples, :cmdtuples unless self.method_defined?(:cmd_tuples)
end
rescue LoadError
raise e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment