easy_translatable 0.2.1 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d87d6fc4d906ec7164dc1afa51c00e91fb4a75a1
4
- data.tar.gz: c667ece3ff6da305d1a92e5f10c842b49c412d00
3
+ metadata.gz: ff59051dd5f5534569166f4b31b9ee93a7a637cd
4
+ data.tar.gz: 72c756caaca02663bc0fe02d61145b568f24324d
5
5
  SHA512:
6
- metadata.gz: 86540d0c52254e9958ac5496d4dc146dac7671e7a16db19d19190a5eb4b9a850498d86fee171262cd4a0cecb761fb715881282fbf5e8f1f5a80beeeeb3fede68
7
- data.tar.gz: 3a116572954e6de7d712b9c599f2d8c4f227ad253633eaf5269592d60767683eb0e8a5b90cf27ed1bfe50284d06034d996c0e4ffb76de25bf1959830610dd19d
6
+ metadata.gz: c603dbf48910d7bb8502408856ad56c9f3a9c8e14d12bbb071667bf8a3c8534ef5cd7d6e6876f56da503d290964602b7266fab076396e74b969ad985f7f03b4c
7
+ data.tar.gz: e2197b3097c3aef681045e244ac0ef60a3b017e2fbbbd4a5bcfa05d5c8766f58912f15e4710143dbbfd03a86c79efd8aef31e5330b46380553e82820b46d4838
@@ -32,25 +32,12 @@ module Translatable
32
32
  end
33
33
  end
34
34
 
35
-
35
+ # Always call the super method, the attribute is translatable and we asked a translated model
36
36
  def write_attribute(name, value, options = {})
37
37
  if translated?(name) && translate?
38
38
  options = {:locale => Translatable.locale}.merge(options)
39
39
 
40
- # Dirty tracking, paraphrased from
41
- # ActiveRecord::AttributeMethods::Dirty#write_attribute.
42
- name_str = name.to_s
43
- if attribute_changed?(name_str)
44
- # If there's already a change, delete it if this undoes the change.
45
- old = changed_attributes[name_str]
46
- changed_attributes.delete(name_str) if value == old
47
- else
48
- # If there's not a change yet, record it.
49
- serialized_value = read_attribute(name, options) if self.serialized_attributes.has_key?(name)
50
- old = translatable.fetch(options[:locale], name, serialized_value)
51
- old = old.clone if old.duplicable?
52
- changed_attributes[name_str] = old if value != old
53
- end
40
+ # We don't want to track any changes, but save the new value in a translation hash
54
41
 
55
42
  translatable.write(options[:locale], name, value)
56
43
  else
@@ -1,3 +1,3 @@
1
1
  module Translatable
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_translatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Bonaud