rails_workflow 0.4.1 → 0.4.2

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: 1455c2f7649e01639b50094825468cefca4117f1
4
- data.tar.gz: fedbbf71998fa72e3ea6f91ff814b769a01646bc
3
+ metadata.gz: bdceaf61577d25aa9f96f6ecb137b324b4285e9f
4
+ data.tar.gz: c8d565433000b1e4865c779ed916dc2d55b29bc2
5
5
  SHA512:
6
- metadata.gz: 3510938b11d1eeab1d7ed7b11e2f6758870b5c93c7ce6213d93a836c389f2b4d2ca38b82c7e19e044dcf60ef54a47898ea95c63310248f1b57a2b5990701b4b4
7
- data.tar.gz: cd6e8b87b0cac21bc89810ae42b13939042fab86599d153277d334d60ab732ae554f46c434e4388b3ceebb506d85a12575be3f44731bb5be1003c9d93792ecbd
6
+ metadata.gz: 88dd3bf227a6548932d3c0fd623e987739bea36070a04ff95361e7763e274e24ed12c0cab520b3986df45a5c220eb0c821c39e178754a3104b230f58f26b7ddf
7
+ data.tar.gz: fac3080b6f6d846f8d48a8bd2cd4f6ab514352c87469b7d1423c2646378d013b79341e6ed7f18a6edf01799bba1904fecc894c8349804461dff44e375769a8eb
@@ -7,7 +7,7 @@ module RailsWorkflow
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
10
- belongs_to :assignment, polymorphic: true
10
+ belongs_to :assignment, polymorphic: true, required: false
11
11
  scope :for_user, ->(user) {
12
12
  keys = RailsWorkflow.config.assignment_by.select { |k| user.respond_to? k }
13
13
 
@@ -6,7 +6,7 @@ module RailsWorkflow
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- belongs_to :assignment, polymorphic: true
9
+ belongs_to :assignment, polymorphic: true, required: false
10
10
 
11
11
  scope :by_role, ->(role) { joins(:template).where(rails_workflow_operation_templates: { role: role }) }
12
12
  scope :by_group, ->(group) { joins(:template).where(rails_workflow_operation_templates: { group: group }) }
@@ -38,14 +38,19 @@ module RailsWorkflow
38
38
  end
39
39
 
40
40
  def form
41
- '_form'.prepend(object.kind)
41
+ '_form'.dup.prepend(object.kind)
42
42
  end
43
43
 
44
44
  def assignment
45
- [
46
- ::User.role_text(object.role),
47
- ::User.group_text(object.group)
48
- ].compact.join(', ')
45
+ [assignment_by_role, assignemt_by_group].compact.join(', ')
46
+ end
47
+
48
+ def assignment_by_role
49
+ User.role_text(object.role) if object.role
50
+ end
51
+
52
+ def assignemt_by_group
53
+ User.group_text(object.group) if object.group
49
54
  end
50
55
 
51
56
  def show_dependencies
@@ -3,7 +3,7 @@
3
3
  module RailsWorkflow
4
4
  # Stores error information
5
5
  class Error < ActiveRecord::Base
6
- belongs_to :parent, polymorphic: true
6
+ belongs_to :parent, polymorphic: true, required: false
7
7
  has_one :context, class_name: 'RailsWorkflow::Context', as: :parent
8
8
  scope :unresolved, -> { where('resolved is null or resolved = false') }
9
9
 
@@ -12,7 +12,7 @@ module RailsWorkflow
12
12
  belongs_to :process, class_name: 'RailsWorkflow::Process'
13
13
  alias parent process
14
14
  belongs_to :template, class_name: 'RailsWorkflow::OperationTemplate'
15
- belongs_to :child_process, class_name: 'RailsWorkflow::Process'
15
+ belongs_to :child_process, class_name: 'RailsWorkflow::Process', required: false
16
16
  has_one :context, class_name: 'RailsWorkflow::Context', as: :parent
17
17
  has_many :workflow_errors, class_name: 'RailsWorkflow::Error', as: :parent
18
18
 
@@ -8,7 +8,7 @@ module RailsWorkflow
8
8
  include OperationTemplates::Assignments
9
9
 
10
10
  belongs_to :process_template, class_name: 'RailsWorkflow::ProcessTemplate'
11
- belongs_to :child_process, class_name: 'RailsWorkflow::ProcessTemplate'
11
+ belongs_to :child_process, class_name: 'RailsWorkflow::ProcessTemplate', required: false
12
12
 
13
13
  scope :other_operations, ->(process_template_id, operation_template_id) {
14
14
  where(process_template_id: process_template_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsWorkflow
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
Binary file
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Madzhuga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '4.1'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 4.1.0
@@ -24,9 +21,6 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '4.1'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: 4.1.0