active_scaffold_batch_vho 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -122,18 +122,25 @@ module ActiveScaffold::Actions
122
122
  def create_record(created_by)
123
123
  @successful = nil
124
124
  @record = new_batch_create_record(created_by)
125
- @record.send("#{batch_create_by_column.to_s}=", created_by)
126
- batch_create_values.each do |attribute, value|
127
- set_record_attribute(value[:column], attribute, value[:value])
128
- end
129
125
 
130
- if authorized_for_job?(@record)
131
- create_save
132
- if successful?
133
- marked_records_parent.delete(created_by.id) if batch_scope == 'MARKED' && marked_records_parent
134
- else
135
- error_records << @record
126
+ unless @record.nil?
127
+ @record.send("#{batch_create_by_column.to_s}=", created_by)
128
+ batch_create_values.each do |attribute, value|
129
+ set_record_attribute(value[:column], attribute, value[:value])
136
130
  end
131
+
132
+ if authorized_for_job?(@record)
133
+ create_save
134
+ if successful?
135
+ marked_records_parent.delete(created_by.id) if batch_scope == 'MARKED' && marked_records_parent
136
+ else
137
+ error_records << @record
138
+ end
139
+ end
140
+ else
141
+ record = do_new
142
+ record.errors.add(:base, as_(:batch_create_record_not_in_scope, :model => created_by.to_label))
143
+ error_records << record
137
144
  end
138
145
  end
139
146
 
@@ -8,4 +8,5 @@ de:
8
8
  division: '/'
9
9
  absolute: abs
10
10
  percent: '%'
11
- batch_update: 'Speichern'
11
+ batch_update: 'Speichern'
12
+ batch_create_record_not_in_scope: 'Datensatz für %{model} konnte nicht angelegt werden auf Grund fehlender Daten'
@@ -8,4 +8,5 @@ en:
8
8
  division: '/'
9
9
  absolute: abs
10
10
  percent: '%'
11
- batch_update: 'Batch Update'
11
+ batch_update: 'Batch Update'
12
+ batch_create_record_not_in_scope: 'Failed to create Record for %{model} due to missing data'
@@ -2,7 +2,7 @@ module ActiveScaffoldBatch
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_batch_vho
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
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: 2014-02-22 00:00:00.000000000Z
12
+ date: 2014-08-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &9732940 !ruby/object:Gem::Requirement
16
+ requirement: &16192880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *9732940
24
+ version_requirements: *16192880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &9732460 !ruby/object:Gem::Requirement
27
+ requirement: &16192400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *9732460
35
+ version_requirements: *16192400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rcov
38
- requirement: &9785380 !ruby/object:Gem::Requirement
38
+ requirement: &16191920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *9785380
46
+ version_requirements: *16191920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: active_scaffold_vho
49
- requirement: &9784900 !ruby/object:Gem::Requirement
49
+ requirement: &16191440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 3.1.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *9784900
57
+ version_requirements: *16191440
58
58
  description: You want to batch create/destroy/update many records at once with activescaffold?
59
59
  email: vhochstein@gmail.com
60
60
  executables: []