rails_workflow 0.3.0 → 0.3.1

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: 0a4a91bde072f32b2d60750cd516e78436d0f40c
4
- data.tar.gz: ad83c4e78cdb420eab39a914602b10cddbdf1c6f
3
+ metadata.gz: 30d3cf67a04d1c32bc4de672d12602975eea40d9
4
+ data.tar.gz: 23739dee3e634f7c9fa5bbc07f91c3fa4c48196e
5
5
  SHA512:
6
- metadata.gz: 263eda34d917a4f69ffa40dd16d6570bdad760c6512f256bd915b167622d7ce14d1820ff3b321ff1407bfd70d76e1aaf916d68551ed79a14e2881bafb6d5aa08
7
- data.tar.gz: d9e44b26185ee60e66b48b01dbeda448be9ca018ec7db78dd7d2d7fda4e846697eac12466f02e263503c97617b846b1153c3a13dc8a7a3f064c1caefec5f6c25
6
+ metadata.gz: 74a02a60d5da5b12b88e64721defdd1b2073204e0dbcdd5ec07ab8ac487bb663962c1fde9d96cde0c0c806e3b718cb79f5419b88803047e093d97f28d67e379f
7
+ data.tar.gz: 4fd7cb5faa4609798daa31f3ca9e39c0680137758a61aef95e6e4cf874a97576cc50bf2789a3a2d1bb055ce96d340380c32443faba41e6abcefb22d8a56957a3
@@ -18,6 +18,8 @@ module RailsWorkflow
18
18
  included do
19
19
  scope :independent_only, -> { where(dependencies: nil) }
20
20
 
21
+ serialize :dependencies, JSON
22
+
21
23
  def resolve_dependency operation
22
24
  true
23
25
  end
@@ -17,6 +17,8 @@ module RailsWorkflow
17
17
 
18
18
  included do
19
19
 
20
+ serialize :dependencies, JSON
21
+
20
22
  # def dependencies=(dependencies)
21
23
  # write_attribute(:dependencies, dependencies.to_json.to_s)
22
24
  # end
@@ -22,7 +22,7 @@ module RailsWorkflow
22
22
 
23
23
 
24
24
  def create
25
- @operation_template = OperationTemplate.create(permitted_params)
25
+ @operation_template = @process_template.operations.create(permitted_params)
26
26
  redirect_to process_template_operation_templates_url
27
27
  end
28
28
 
@@ -3,6 +3,8 @@ module RailsWorkflow
3
3
  belongs_to :parent, polymorphic: true
4
4
  attr_accessor :data
5
5
 
6
+ serialize :body, JSON
7
+
6
8
  before_save :serialize_data
7
9
  after_find :init_data
8
10
 
@@ -45,7 +45,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
45
45
  :rails_workflow_contexts => [
46
46
  [:integer, :parent_id],
47
47
  [:string, :parent_type],
48
- [:json, :body],
48
+ [:text, :body],
49
49
  [:datetime, :created_at],
50
50
  [:datetime, :updated_at],
51
51
  ],
@@ -66,7 +66,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
66
66
  [:uuid, :uuid],
67
67
  [:string, :tag],
68
68
  [:text, :source],
69
- [:json, :dependencies],
69
+ [:text, :dependencies],
70
70
  [:string, :operation_class],
71
71
  [:integer, :process_template_id],
72
72
  [:datetime, :created_at],
@@ -94,7 +94,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
94
94
  [:datetime, :updated_at],
95
95
  [:integer, :process_id],
96
96
  [:integer, :template_id],
97
- [:json, :dependencies],
97
+ [:text, :dependencies],
98
98
  [:integer, :child_process_id],
99
99
  [:integer, :assignment_id],
100
100
  [:string, :assignment_type],
@@ -147,8 +147,9 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
147
147
  [RailsWorkflow::OperationTemplate, :dependencies],
148
148
  [RailsWorkflow::Context, :body]
149
149
  ].map do |check|
150
- if check[0].columns_hash[check[1].to_s].sql_type != "json"
151
- change_column check[0].table_name, check[1], "JSON USING #{check[1]}::JSON"
150
+ if check[0].columns_hash[check[1].to_s].sql_type == "json"
151
+ # change_column check[0].table_name, check[1], "JSON USING #{check[1]}::JSON"
152
+ change_column check[0].table_name, check[1], :text
152
153
  end
153
154
  end
154
155
  end
@@ -45,7 +45,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
45
45
  :rails_workflow_contexts => [
46
46
  [:integer, :parent_id],
47
47
  [:string, :parent_type],
48
- [:json, :body],
48
+ [:text, :body],
49
49
  [:datetime, :created_at],
50
50
  [:datetime, :updated_at],
51
51
  ],
@@ -66,7 +66,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
66
66
  [:uuid, :uuid],
67
67
  [:string, :tag],
68
68
  [:text, :source],
69
- [:json, :dependencies],
69
+ [:text, :dependencies],
70
70
  [:string, :operation_class],
71
71
  [:integer, :process_template_id],
72
72
  [:datetime, :created_at],
@@ -94,7 +94,7 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
94
94
  [:datetime, :updated_at],
95
95
  [:integer, :process_id],
96
96
  [:integer, :template_id],
97
- [:json, :dependencies],
97
+ [:text, :dependencies],
98
98
  [:integer, :child_process_id],
99
99
  [:integer, :assignment_id],
100
100
  [:string, :assignment_type],
@@ -147,8 +147,9 @@ class CreateWorkflowProcesses < ActiveRecord::Migration
147
147
  [RailsWorkflow::OperationTemplate, :dependencies],
148
148
  [RailsWorkflow::Context, :body]
149
149
  ].map do |check|
150
- if check[0].columns_hash[check[1].to_s].sql_type != "json"
151
- change_column check[0].table_name, check[1], "JSON USING #{check[1]}::JSON"
150
+ if check[0].columns_hash[check[1].to_s].sql_type == "json"
151
+ # change_column check[0].table_name, check[1], "JSON USING #{check[1]}::JSON"
152
+ change_column check[0].table_name, check[1], :text
152
153
  end
153
154
  end
154
155
  end
@@ -1,3 +1,3 @@
1
1
  module RailsWorkflow
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -73,6 +73,8 @@ module RailsWorkflow
73
73
  operation_template: valid_attributes
74
74
  }, valid_session, use_route: :workflow
75
75
  }.to change(OperationTemplate, :count).by(1)
76
+
77
+ expect(@template.operations.count).to eq 1
76
78
  end
77
79
 
78
80
  it "creates a new CustomOperationTemplate" do
@@ -1,16 +1,11 @@
1
1
  defaults: &defaults
2
2
  adapter: postgresql
3
3
  encoding: unicode
4
- username: username
4
+ username: postgres
5
+ password: postgres
5
6
  host: localhost
6
7
  port: 5432
7
- pool: 14
8
- reaping_frequency: 10
9
8
 
10
- development:
9
+ test:
11
10
  <<: *defaults
12
- database: wf_def
13
-
14
- test: &test
15
- <<: *defaults
16
- database: wf_test
11
+ database: wf_test
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150625034602) do
14
+ ActiveRecord::Schema.define(version: 20150629171932) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
@@ -27,7 +27,7 @@ ActiveRecord::Schema.define(version: 20150625034602) do
27
27
  create_table "rails_workflow_contexts", force: :cascade do |t|
28
28
  t.integer "parent_id"
29
29
  t.string "parent_type"
30
- t.json "body"
30
+ t.text "body"
31
31
  t.datetime "created_at"
32
32
  t.datetime "updated_at"
33
33
  end
@@ -49,7 +49,7 @@ ActiveRecord::Schema.define(version: 20150625034602) do
49
49
  create_table "rails_workflow_operation_templates", force: :cascade do |t|
50
50
  t.string "title"
51
51
  t.text "source"
52
- t.json "dependencies"
52
+ t.text "dependencies"
53
53
  t.string "operation_class"
54
54
  t.integer "process_template_id"
55
55
  t.datetime "created_at"
@@ -81,7 +81,7 @@ ActiveRecord::Schema.define(version: 20150625034602) do
81
81
  t.datetime "updated_at"
82
82
  t.integer "process_id"
83
83
  t.integer "template_id"
84
- t.json "dependencies"
84
+ t.text "dependencies"
85
85
  t.integer "child_process_id"
86
86
  t.integer "assignment_id"
87
87
  t.string "assignment_type"