schematic 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -156,7 +156,7 @@ module Schematic
156
156
  def nested_attributes
157
157
  return [] unless @klass.respond_to?(:reflect_on_all_associations)
158
158
  @klass.reflect_on_all_associations.select do |association|
159
- @klass.instance_methods.include?("#{association.name}_attributes=".to_sym) && association.options[:polymorphic] != true
159
+ @klass.instance_methods.include?("#{association.name}_attributes=".to_sym) && association.options[:polymorphic] != true && !@klass.schematic_sandbox.ignored_elements.include?(association.name.to_sym)
160
160
  end
161
161
  end
162
162
 
@@ -1,3 +1,3 @@
1
1
  module Schematic
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -234,6 +234,36 @@ describe Schematic::Serializers::Xsd do
234
234
  end
235
235
  end
236
236
 
237
+ context "when the model has a nested attribute which is ignored" do
238
+ with_model :car do
239
+ table {}
240
+ model do
241
+ has_one :engine
242
+ accepts_nested_attributes_for :engine
243
+ schematic do
244
+ ignore :engine
245
+ end
246
+ end
247
+ end
248
+
249
+ with_model :engine do
250
+ table do |t|
251
+ t.integer :car_id
252
+ end
253
+
254
+ model do
255
+ belongs_to :car
256
+ end
257
+ end
258
+
259
+ subject { Car.to_xsd }
260
+
261
+ it "should generate a valid XSD" do
262
+ subject.should_not include "engine-attributes"
263
+ validate_xsd(subject)
264
+ end
265
+ end
266
+
237
267
  context "when the model has a circular nested attribute reference" do
238
268
  with_model :plate do
239
269
  table {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schematic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-21 00:00:00.000000000Z
12
+ date: 2011-10-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &2160906360 !ruby/object:Gem::Requirement
16
+ requirement: &2156382040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160906360
24
+ version_requirements: *2156382040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: builder
27
- requirement: &2160898860 !ruby/object:Gem::Requirement
27
+ requirement: &2156381140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160898860
35
+ version_requirements: *2156381140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &2160897360 !ruby/object:Gem::Requirement
38
+ requirement: &2156379260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.1'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2160897360
46
+ version_requirements: *2156379260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: with_model
49
- requirement: &2160896060 !ruby/object:Gem::Requirement
49
+ requirement: &2156361020 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2160896060
57
+ version_requirements: *2156361020
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &2160893960 !ruby/object:Gem::Requirement
60
+ requirement: &2156360300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2160893960
68
+ version_requirements: *2156360300
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
- requirement: &2160893000 !ruby/object:Gem::Requirement
71
+ requirement: &2156358880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2160893000
79
+ version_requirements: *2156358880
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: autotest
82
- requirement: &2160891200 !ruby/object:Gem::Requirement
82
+ requirement: &2156358200 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2160891200
90
+ version_requirements: *2156358200
91
91
  description: Automatic XSD generation from ActiveRecord models
92
92
  email:
93
93
  - casecommons-dev@googlegroups.com
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  segments:
155
155
  - 0
156
- hash: -4035158889682443836
156
+ hash: -4443311822607440419
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  none: false
159
159
  requirements:
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  version: '0'
163
163
  segments:
164
164
  - 0
165
- hash: -4035158889682443836
165
+ hash: -4443311822607440419
166
166
  requirements: []
167
167
  rubyforge_project: schematic
168
168
  rubygems_version: 1.8.10