xml_active 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -263,6 +263,7 @@ XML Active supports has_one association with all options and following arr the b
263
263
  * 0.0.2 First Release
264
264
  * 0.0.3 Addition of support for One to One associations, various bug fixes and testing in Rails 3.0.7, 3.1.0 and 3.2.2
265
265
  * 0.0.4 Dropped support for 3.0.x and continued testing on 3.1.x and 3.2.x. Added support for Microsoft Office style XML
266
+ * 0.0.5 Resolved issue where the parent record in a one to many relationship had not been saved causing validation errors when saving child records
266
267
 
267
268
  === Future Features
268
269
 
data/lib/xml_active.rb CHANGED
@@ -110,6 +110,21 @@ module XmlActive
110
110
 
111
111
 
112
112
  unless active_record.nil?
113
+ # Process the attributes
114
+ if options.include? :update or options.include? :sync or options.include? :create
115
+ assign_attributes_from current_node, :to => active_record
116
+ end
117
+
118
+ # Save the record
119
+ if options.include? :sync
120
+ # Doing complete synchronisation with XML
121
+ active_record.save
122
+ elsif options.include?(:create) and active_record.new_record?
123
+ active_record.save
124
+ elsif options.include?(:update) and not active_record.new_record?
125
+ active_record.save
126
+ end
127
+
113
128
  # Check through associations and apply sync appropriately
114
129
  self.reflect_on_all_associations.each do |association|
115
130
  foreign_key = foreign_key_from(association)
@@ -184,21 +199,6 @@ module XmlActive
184
199
  raise "unsupported association #{association.macro} for #{association.name } on #{self.name}"
185
200
  end
186
201
  end
187
-
188
- # Process the attributes
189
- if options.include? :update or options.include? :sync or options.include? :create
190
- assign_attributes_from current_node, :to => active_record
191
- end
192
-
193
- # Save the record
194
- if options.include? :sync
195
- # Doing complete synchronisation with XML
196
- active_record.save
197
- elsif options.include?(:create) and active_record.new_record?
198
- active_record.save
199
- elsif options.include?(:update) and not active_record.new_record?
200
- active_record.save
201
- end
202
202
  end
203
203
 
204
204
  active_record
@@ -1,3 +1,3 @@
1
1
  module XmlActive
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_active
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-12 00:00:00.000000000 Z
12
+ date: 2012-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -97,5 +97,5 @@ rubyforge_project: xml_active
97
97
  rubygems_version: 1.8.22
98
98
  signing_key:
99
99
  specification_version: 3
100
- summary: xml_active 0.0.4
100
+ summary: xml_active 0.0.5
101
101
  test_files: []