wraithdb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -14,4 +14,5 @@ rdoc
14
14
  spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
+ gh-pages
17
18
  tmp
@@ -1,23 +1,24 @@
1
1
  module ActiveRecord
2
2
  class Base
3
3
  class << self
4
- # This clobbers the DB Charmer wrapping of relation and does the same thing except
5
- # it leaves connection resolution to runtime rather than assigning an instance variable
6
- def relation_with_db_charmer(*args, &block)
7
- relation_without_db_charmer(*args, &block).tap do |rel|
8
- begin
9
- rel.db_charmer_connection = @connection
10
- rescue StandardError => e
11
- base = self
12
- rel.define_singleton_method(:db_charmer_connection) do
13
- base.connection
14
- end
4
+
5
+ def relation_with_wraith_charmed(*args, &block)
6
+ begin
7
+ relation_without_wraith_charmed(*args, &block)
8
+ rescue StandardError => e
9
+ # This leaves connection resolution for db_charmer to runtime rather than assigning an
10
+ # instance variable
11
+ base = self
12
+ rel = relation_without_db_charmer
13
+ rel.define_singleton_method(:db_charmer_connection) do
14
+ base.connection
15
15
  end
16
16
  rel.db_charmer_enable_slaves = self.db_charmer_slaves.any?
17
17
  rel.db_charmer_connection_is_forced = !db_charmer_top_level_connection?
18
+ rel
18
19
  end
19
20
  end
20
- alias relation relation_with_db_charmer
21
+ alias_method_chain :relation, :wraith_charmed
21
22
  end
22
23
  end
23
24
  end
@@ -1,3 +1,3 @@
1
1
  module Wraithdb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wraithdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord