db-charmer 1.6.4 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,6 +1,12 @@
1
+ 1.6.5 (2010-04-05):
2
+
3
+ Bugfix release: Fixed :connection vs :slave in db_magic behaviour. Model.on_master should
4
+ run queries on the master, not on AR's default connection.
5
+
6
+ ----------------------------------------------------------------------------------------
1
7
  1.6.4 (2010-04-05):
2
8
 
3
- Default behaviour changed: DbCharmer.connections_should_exist is true in all environments
9
+ Default behaviour changed: DbCharmer.connections_should_exist is true in all environments
4
10
  by default. Old default behaviour was too misleading for many developers.
5
11
 
6
12
  ----------------------------------------------------------------------------------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.4
1
+ 1.6.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{db-charmer}
8
- s.version = "1.6.4"
8
+ s.version = "1.6.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexey Kovyrin"]
@@ -36,6 +36,16 @@ module DbCharmer
36
36
  @@db_charmer_connection_proxies[self.name]
37
37
  end
38
38
 
39
+ #-----------------------------------------------------------------------------
40
+ @@db_charmer_default_connection = nil
41
+ def db_charmer_default_connection=(conn)
42
+ @@db_charmer_default_connection = conn
43
+ end
44
+
45
+ def db_charmer_default_connection
46
+ @@db_charmer_default_connection
47
+ end
48
+
39
49
  #-----------------------------------------------------------------------------
40
50
  @@db_charmer_slaves = {}
41
51
  def db_charmer_slaves=(slaves)
@@ -9,7 +9,7 @@ module DbCharmer
9
9
  should_exist = opt[:should_exist] || DbCharmer.connections_should_exist?
10
10
 
11
11
  # Main connection management
12
- setup_connection_magic(opt[:connection], should_exist) if opt[:connection]
12
+ setup_connection_magic(opt[:connection], should_exist)
13
13
 
14
14
  # Set up slaves pool
15
15
  opt[:slaves] ||= []
@@ -59,6 +59,7 @@ module DbCharmer
59
59
 
60
60
  def setup_connection_magic(conn, should_exist = false)
61
61
  switch_connection_to(conn, should_exist)
62
+ self.db_charmer_default_connection = conn
62
63
  end
63
64
 
64
65
  def setup_slaves_magic(slaves, should_exist = false)
@@ -56,7 +56,7 @@ module DbCharmer
56
56
  end
57
57
 
58
58
  def on_master(proxy_target = nil, &block)
59
- on_db(nil, proxy_target, &block)
59
+ on_db(db_charmer_default_connection, proxy_target, &block)
60
60
  end
61
61
  end
62
62
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 4
9
- version: 1.6.4
8
+ - 5
9
+ version: 1.6.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alexey Kovyrin