def connection_url_to_hash(url)
      url ||= ''
      uri = URI.parse url
      spec = {
        host:     uri.host,
        port:     uri.port,
        adapter:  uri.scheme,
        username: uri.user,
        password: uri.password,
        database: uri.path.sub(%r{^/}, '')
      }
      spec.reject! {|_, value| !value}
      {adapter: 'redis'}.merge spec
    end
def connection_url_to_hash(url)
      url ||= ''
      uri = URI.parse url
      spec = {
        host:     uri.host,
        port:     uri.port,
        adapter:  uri.scheme,
        username: uri.user,
        password: uri.password,
        database: uri.path.sub(%r{^/}, '')
      }
      spec.reject! {|_, value| !value}
      {adapter: 'redis'}.merge spec
    end
from https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/connection_specification.rb#L65