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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbfdd2b759ba3c8ea9e57f278d5f33ea7e4c4f40
4
- data.tar.gz: '07681f55d659bede0ce1a25048514068498a1859'
3
+ metadata.gz: bb8964cf95b2ee9cf7e0d9f5854173805354d981
4
+ data.tar.gz: 33d5409e4d1b58751109e1b8aa37d29994799a34
5
5
  SHA512:
6
- metadata.gz: d4981206c465c928f6320b79395069c734121f928ae48ae1ddb6559cb2749b077e38292f25bd2415baf5a6fd800e82ff899dcda8dd3bb148b6a979e483e9e0e0
7
- data.tar.gz: 449f570449d3c4edba3a026c15091e13f04190eb4ce3ee465ae437e68656479b08bc5829f620a1711ac63399747dd352428de414000563480af2f26d85ee0e1c
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
- send(adapter_name).write(remote_attribute, value)
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
@@ -1,3 +1,3 @@
1
1
  module ActiveTools
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.4
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-04-09 00:00:00.000000000 Z
11
+ date: 2017-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails