dbhijacker 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.rdoc +8 -1
- data/dbhijacker.gemspec +1 -1
- data/lib/hijacker.rb +5 -0
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
Hijacker
|
2
2
|
========
|
3
3
|
|
4
|
-
|
4
|
+
I don't recommend you use this gem. It is not production quality.
|
5
|
+
|
6
|
+
Notes for adding thread safety:
|
7
|
+
https://github.com/discourse/discourse/blob/691377b5af72ea0f3223223cfb623b991c96cbb8/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb
|
8
|
+
|
9
|
+
One application, multiple client databases. Although customizable, by default
|
10
|
+
uses a combination of database and regular expression matching against the host
|
11
|
+
domain to figure out which database to connect to.
|
5
12
|
|
6
13
|
Example
|
7
14
|
=======
|
data/dbhijacker.gemspec
CHANGED
data/lib/hijacker.rb
CHANGED
@@ -172,6 +172,11 @@ module Hijacker
|
|
172
172
|
sister || master
|
173
173
|
end
|
174
174
|
|
175
|
+
def self.do_hijacking?
|
176
|
+
(Hijacker.config[:hosted_environments] || %w[staging production]).
|
177
|
+
include?(ENV['RAILS_ENV'] || Rails.env)
|
178
|
+
end
|
179
|
+
|
175
180
|
# just calling establish_connection doesn't actually check to see if
|
176
181
|
# we've established a VALID connection. a call to connection will check
|
177
182
|
# this, and throw an error if the connection's invalid. It is important
|