polyrex-createobject 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/polyrex-createobject.rb +10 -4
  2. metadata +1 -1
@@ -32,8 +32,13 @@ class PolyrexCreateObject
32
32
  %Q(
33
33
  def #{name}(params={}, id=nil,&blk)
34
34
 
35
- create_node(@parent_node, @rpaths['#{xpath}'], params, id).element('records')
36
- blk.call(self) if block_given?
35
+ orig_parent = @parent_node
36
+ new_parent = create_node(@parent_node, @rpaths['#{xpath}'], params, id).element('records')
37
+ if block_given? then
38
+ self.record = new_parent
39
+ blk.call(self)
40
+ end
41
+ self.record = orig_parent
37
42
 
38
43
  self
39
44
  end
@@ -68,9 +73,10 @@ end
68
73
  end
69
74
 
70
75
  a = child_schema[/[^\[]+(?=\])/].split(',')
76
+ summary = record.element('summary')
71
77
  a.each do |field_name|
72
- field = record.element('summary/' + field_name.strip)
73
- field.text = params[field_name.to_sym]
78
+ field = summary.element(field_name.strip)
79
+ field.text = params[field_name.strip.to_sym]
74
80
  end
75
81
 
76
82
  parent_node.add record.root
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-createobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors: []
7
7