datamappify 0.51.0 → 0.51.1

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: f9765005a9b047c0dabab75eeb3da7997761c57d
4
- data.tar.gz: c6747c591e913b7565a730ea7192703991aaf2b6
3
+ metadata.gz: e2eb31e15b5957467c3d496b2ddaf6f584d4b652
4
+ data.tar.gz: 7515f3c6935418a502e22213c75b7465a5faaf4e
5
5
  SHA512:
6
- metadata.gz: 64566dfe4f603db5104657ca9416aef1d96f4b0327de25c0c9a36a68285b3dcf049efd2c39381f5f4f2ab7b781509c13f0c4ef27b02066e9b634e5cd23c56720
7
- data.tar.gz: 0bc81a94c2c52c1b3da152d79f39405be5050e2242c526d628650591a4e741250f5d47136c93ef96a2a1f63f6c264200754ad603ea41954aafaffb2ce2f91cda
6
+ metadata.gz: 5f014a40766499d0f3e076d7ff82117a1e1bb5b5752741c917f14bcd5d5daceb1c5e080211f3bdd83cd8478425eb87d7ebee20582622fc0d23542f0150dcf91a
7
+ data.tar.gz: c13d2de1a9596ccfe8951a7d447e749529f4ab5539b2f33bed0499a12e000dca871e36a040401d2f405f96037d3c440d585326bfbb94db880154b35bea06a149
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## 0.51.1 [2013-06-17]
4
+
5
+ - Fixed an issue with attribute name and validation conflicts.
6
+
3
7
  ## 0.51.0 [2013-06-17]
4
8
 
5
9
  - Enhanced `find` for searching specific attributes.
@@ -23,9 +23,9 @@ module Datamappify
23
23
  #
24
24
  # @return (see #attributes_from)
25
25
  def setup_attributes(entity_class, options)
26
- entity_class.attribute_set.dup.each do |attribute|
26
+ entity_class.attribute_set.each do |attribute|
27
27
  unless excluded_attributes(entity_class).include?(attribute.name)
28
- self.attribute_set << tweak_attribute(attribute, options)
28
+ self.attribute_set << tweak_attribute(attribute.dup, options)
29
29
  end
30
30
  end
31
31
  end
@@ -57,13 +57,9 @@ module Datamappify
57
57
  # @return [void]
58
58
  def rename_validators(entity_class, prefix)
59
59
  entity_class._validators.each do |attribute_name, validators|
60
- dup_validators = validators.dup
61
-
62
- dup_validators.each do |validator|
63
- rename_validator_attributes(validator, prefix)
60
+ self._validators[:"#{prefix}_#{attribute_name}"] = validators.map do |validator|
61
+ rename_validator_attributes(validator.dup, prefix)
64
62
  end
65
-
66
- self._validators[:"#{prefix}_#{attribute_name}"] = dup_validators
67
63
  end
68
64
  end
69
65
 
@@ -74,6 +70,7 @@ module Datamappify
74
70
  # @return [void]
75
71
  def rename_validator_attributes(validator, prefix)
76
72
  validator.instance_variable_set :@attributes, validator.attributes.map { |name| :"#{prefix}_#{name}" }
73
+ validator
77
74
  end
78
75
 
79
76
  # @param entity_class [Entity]
@@ -1,3 +1,3 @@
1
1
  module Datamappify
2
- VERSION = '0.51.0'
2
+ VERSION = '0.51.1'
3
3
  end
@@ -13,7 +13,12 @@ describe Datamappify::Entity do
13
13
  :software_osx_id => 1,
14
14
  :software_windows_id => 2,
15
15
  :software_linux_id => 3,
16
- :software_vendor => 'Lotus'
16
+ :software_vendor => 'Lotus',
17
+ :game_os => 'OS X',
18
+ :game_osx_id => 1,
19
+ :game_windows_id => 2,
20
+ :game_linux_id => 3,
21
+ :game_vendor => 'Lotus'
17
22
  })
18
23
  end
19
24
 
@@ -27,6 +32,11 @@ describe Datamappify::Entity do
27
32
  its(:software_windows_id) { should == 2 }
28
33
  its(:software_linux_id) { should == 3 }
29
34
  its(:software_vendor) { should == 'Lotus' }
35
+ its(:game_os) { should == 'OS X' }
36
+ its(:game_osx_id) { should == 1 }
37
+ its(:game_windows_id) { should == 2 }
38
+ its(:game_linux_id) { should == 3 }
39
+ its(:game_vendor) { should == 'Lotus' }
30
40
 
31
41
  describe "validation" do
32
42
  context "valid" do
@@ -8,6 +8,7 @@ class Computer
8
8
 
9
9
  attributes_from ComputerHardware
10
10
  attributes_from ComputerSoftware, :prefix_with => :software
11
+ attributes_from ComputerSoftware, :prefix_with => :game
11
12
 
12
13
  validates :brand, :presence => true
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datamappify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.51.0
4
+ version: 0.51.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Wu