active_tools 0.0.38 → 0.0.39

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: 556632e5dcf68f617f8b4a1aae622af0ac7232e6
4
- data.tar.gz: a5fbbeaafe69366ded3cf4d31ca666b6ef297171
3
+ metadata.gz: 89aae5bfc10620868e8c1c02ef12d75818c85838
4
+ data.tar.gz: 7f736e8e7570394a8fb02e23ba0cce357d659730
5
5
  SHA512:
6
- metadata.gz: e854d2821ffac240567bf50c809a19b132805e1216e591ba78e955a75de5d3118005bd7bfb5d5a86722868a5135161f4dd52191c61f0658970f0548a7792ced8
7
- data.tar.gz: a60569d92dea4e0e8983f8f3ddeaffc770f7c30c993d66fe1af1f1c38dbe96885de262b9af4e05f5bbdd8e0664b978cacd13b1685cf82052066688b93cc716c4
6
+ metadata.gz: d4bab0a33a7d2d754e5235f8d432ed769756b69975356f43105806fec231acb18c4ef34d477e36ff193a4c3fb8969fa84bfd08de74d1fb1f9044d363f464a524
7
+ data.tar.gz: b03fd9a5e44114126dc7fea19d807b2d32b626394c37d35b70f969cd1945f19aaa72741b8ec897895946d7138b775b7b686df9d6fe26f901daf14567098351b5
@@ -11,7 +11,8 @@ module ActiveTools
11
11
  @assoc_name = assoc_name
12
12
  @options = options.with_indifferent_access
13
13
  @foreign_key = reflection.foreign_key
14
- @remote_attributes = @options[:attr_map].keys
14
+ @attr_map = @options[:attr_map]
15
+ @remote_attributes = @attr_map.keys
15
16
  @init_proc = @options[:init_proc]
16
17
  @nullify_if = @options[:nullify_if]
17
18
  @update_if = @options[:update_if]
@@ -35,12 +36,13 @@ module ActiveTools
35
36
 
36
37
  def write(name, value)
37
38
  valid_attribute?(name)
39
+ local_attribute = @attr_map[name]
38
40
  if value != read(name)
39
- owner.send(:attribute_will_change!, name)
41
+ owner.send(:attribute_will_change!, local_attribute)
40
42
  store_backup!
41
43
  create_template!
42
44
  target.send("#{name}=", value)
43
- owner.send(:clear_attribute_changes, name) if owner.changes[name].try(:last) == owner.changes[name].try(:first)
45
+ owner.send(:clear_attribute_changes, local_attribute) if owner.changes[local_attribute].try(:last) == owner.changes[local_attribute].try(:first)
44
46
  if @backup.present? && same_records?(@backup, target, :attributes => @remote_attributes)
45
47
  restore_backup!
46
48
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveTools
2
- VERSION = "0.0.38"
2
+ VERSION = "0.0.39"
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.0.38
4
+ version: 0.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valery Kvon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails