Sha256: 31f00a28942416262a0fc562dae3a1ee53a41b45ac8a924457d65b9f8fbbcc46
Contents?: true
Size: 548 Bytes
Versions: 2
Compression:
Stored size: 548 Bytes
Contents
module Apartment module Elevators # Provides a rack based db switching solution based on hosts # Uses a hash to find the corresponding database name for the host # class HostHash < Generic def initialize(app, hash = {}, processor = nil) super app, processor @hash = hash end def parse_database_name(request) raise DatabaseNotFound, "Cannot find database for host #{request.host}" unless @hash.has_key?(request.host) @hash[request.host] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
apartment-0.22.1 | lib/apartment/elevators/host_hash.rb |
apartment-0.22.0 | lib/apartment/elevators/host_hash.rb |