active_tools 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_tools/active_record/adaptive_belongs_to.rb +11 -1
- data/lib/active_tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8964cf95b2ee9cf7e0d9f5854173805354d981
|
4
|
+
data.tar.gz: 33d5409e4d1b58751109e1b8aa37d29994799a34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f33f7caee1c3e94277410f8136b5dbb36404bfb17fea9ad73490e6fae463c03560275c433ae0ab91fccab90b73269e33476630b67cddd26da7479ccce7d7056
|
7
|
+
data.tar.gz: 0ab2209bca78f50d5c217915d326491b1b1ad185f77084b71a05db648936679e88fb1ed53a3db36ca54eb866bc2c00eb0e1988c7d473046ea7f32bc1d310bf75
|
@@ -87,13 +87,23 @@ module ActiveTools
|
|
87
87
|
EOV
|
88
88
|
|
89
89
|
attr_map.each do |remote_attribute, local_attribute|
|
90
|
+
if Rails.version >= "5.0"
|
91
|
+
attribute local_attribute, reflection.klass.attribute_types[remote_attribute].dup
|
92
|
+
after_initialize do
|
93
|
+
self[local_attribute] = send(local_attribute)
|
94
|
+
end
|
95
|
+
end
|
90
96
|
relation_options_under(local_attribute, assoc_name => remote_attribute)
|
91
97
|
class_eval do
|
92
98
|
define_method local_attribute do
|
93
99
|
send(adapter_name).read(remote_attribute)
|
94
100
|
end
|
95
101
|
define_method "#{local_attribute}=" do |value|
|
96
|
-
|
102
|
+
if Rails.version >= "5.0"
|
103
|
+
super send(adapter_name).write(remote_attribute, value)
|
104
|
+
else
|
105
|
+
send(adapter_name).write(remote_attribute, value)
|
106
|
+
end
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
data/lib/active_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valery Kvon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|