inheritance_integer_type 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inheritance_integer_type/extensions.rb +11 -10
- data/lib/inheritance_integer_type/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a8dfac2f20647d7ae593cd3c4703585cc3206f
|
4
|
+
data.tar.gz: b3740e25777985015bfc3e69bfd1bce1694045ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9645040244a4a1fdef44d79362ef075e356fdfa2648f36f794045d229b3e1ffc49deef651e52e65fc2c5f0cc7bcbf8e4a49b3dd405aea92685a7091c6368522a
|
7
|
+
data.tar.gz: 30bd7e83d396df14f7901e992a9d61dc557b95d79109a414fb9253a43009fd680d8a6b595a22c7172a0a36edfa321ef0ab3d56c63896ea539f3e060dd35bdec8
|
@@ -16,26 +16,27 @@ module InheritanceIntegerType
|
|
16
16
|
klass = sti_name_without_integer_types
|
17
17
|
self._inheritance_mapping.key(klass) || klass
|
18
18
|
end
|
19
|
-
|
20
|
-
|
21
19
|
end
|
22
20
|
|
23
21
|
included do
|
24
|
-
|
25
|
-
|
22
|
+
class << self
|
23
|
+
def _inheritance_mapping
|
24
|
+
@_inheritance_mapping ||= (superclass == ActiveRecord::Base ? {} : superclass._inheritance_mapping.dup)
|
25
|
+
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def _inheritance_mapping=(val)
|
28
|
+
@_inheritance_mapping = val
|
29
|
+
end
|
30
|
+
|
31
|
+
def merge_mapping!(mapping)
|
28
32
|
conflicts = _inheritance_mapping.keys & mapping.keys
|
29
33
|
raise ArgumentError.new("Duplicate mapping detected for keys: #{conflicts}") if conflicts.any?
|
30
34
|
|
31
35
|
_inheritance_mapping.merge!(mapping)
|
32
36
|
end
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
alias_method_chain :sti_name, :integer_types
|
37
|
-
end
|
38
|
-
}
|
38
|
+
alias_method_chain :sti_name, :integer_types
|
39
|
+
end
|
39
40
|
end
|
40
41
|
|
41
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inheritance_integer_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.5.2
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Allow the type field in teh DB to be an integer rather than a string
|