bigamy 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bigamy.gemspec +1 -1
- data/lib/bigamy.rb +18 -4
- data/test/unit/test_ar_side.rb +0 -4
- data/test/unit/test_mongo_side.rb +0 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bigamy.gemspec
CHANGED
data/lib/bigamy.rb
CHANGED
@@ -24,8 +24,11 @@ module Bigamy
|
|
24
24
|
|
25
25
|
module Base
|
26
26
|
def self.configure(model)
|
27
|
-
model
|
28
|
-
|
27
|
+
class << model
|
28
|
+
def bigamy_associations
|
29
|
+
@bigamy_associations ||= {}
|
30
|
+
end
|
31
|
+
end
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
@@ -38,6 +41,7 @@ module Bigamy
|
|
38
41
|
module ClassMethods
|
39
42
|
def divorce_everyone
|
40
43
|
self.bigamy_associations.each {|k,v| v.divorce_everyone }
|
44
|
+
self.bigamy_associations.clear
|
41
45
|
end
|
42
46
|
|
43
47
|
def belongs_to_ar name, options = {}
|
@@ -57,7 +61,7 @@ module Bigamy
|
|
57
61
|
def set_value c, val
|
58
62
|
write_key c, val
|
59
63
|
end
|
60
|
-
|
64
|
+
|
61
65
|
def read_val c
|
62
66
|
read_key c
|
63
67
|
end
|
@@ -70,6 +74,12 @@ module Bigamy
|
|
70
74
|
i
|
71
75
|
end
|
72
76
|
end
|
77
|
+
|
78
|
+
module PluginAddition
|
79
|
+
def self.included(model)
|
80
|
+
model.plugin Bigamy::Mongo
|
81
|
+
end
|
82
|
+
end
|
73
83
|
end
|
74
84
|
|
75
85
|
module ActiveRecord
|
@@ -83,6 +93,7 @@ module Bigamy
|
|
83
93
|
module ClassMethods
|
84
94
|
def divorce_everyone
|
85
95
|
self.bigamy_associations.each {|k,v| v.divorce_everyone }
|
96
|
+
self.bigamy_associations.clear
|
86
97
|
end
|
87
98
|
|
88
99
|
def belongs_to_mm name, options = {}
|
@@ -102,7 +113,7 @@ module Bigamy
|
|
102
113
|
def set_value c, val
|
103
114
|
self[c] = val
|
104
115
|
end
|
105
|
-
|
116
|
+
|
106
117
|
def read_val c
|
107
118
|
read_attribute c
|
108
119
|
end
|
@@ -118,3 +129,6 @@ module Bigamy
|
|
118
129
|
end
|
119
130
|
|
120
131
|
end
|
132
|
+
|
133
|
+
MongoMapper::Document.append_inclusions(Bigamy::Mongo::PluginAddition)
|
134
|
+
Bigamy::ActiveRecord.configure(ActiveRecord::Base)
|
data/test/unit/test_ar_side.rb
CHANGED