culturecode_stagehand 0.7.13 → 0.7.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stagehand/schema.rb +1 -2
- data/lib/stagehand/staging/commit_entry.rb +8 -0
- data/lib/stagehand/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac363341da8677b3c1cfd520613c84e0867f3ad2
|
4
|
+
data.tar.gz: 9589806d9dd238748cc953f54f411ef442a8d63c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54f5ea80bac184c901919d16e9832a2c7b09b208916ab92f744d783dd9079d8af88609e92b568bbe705a75f20ada6d708caf6bebf5db15c07681f2cc437b3c77
|
7
|
+
data.tar.gz: bdac04efe1e754db2a006a6bb86ec6ef09e192d00066ba969f6dd8260a7b54daf67b8d777cac8a0e574528188e27c607cadc1d0c5b2a224723893680e7d4b817
|
data/lib/stagehand/schema.rb
CHANGED
@@ -17,9 +17,8 @@ module Stagehand
|
|
17
17
|
end
|
18
18
|
|
19
19
|
add_index :stagehand_commit_entries, :commit_id # Used for looking up all entries within a commit
|
20
|
-
add_index :stagehand_commit_entries, :operation # Mostly used for looking up start entries
|
21
20
|
add_index :stagehand_commit_entries, [:record_id, :table_name] # Used for 'matching' scope
|
22
|
-
add_index :stagehand_commit_entries, [:operation, :commit_id] # Used for 'not_in_progress' scope
|
21
|
+
add_index :stagehand_commit_entries, [:operation, :commit_id] # Used for looking up start entries, and 'not_in_progress' scope
|
23
22
|
|
24
23
|
# Create trigger to initialize session using a function
|
25
24
|
ActiveRecord::Base.connection.execute("DROP TRIGGER IF EXISTS stagehand_session_trigger;")
|
@@ -115,6 +115,8 @@ module Stagehand
|
|
115
115
|
|
116
116
|
def record_class
|
117
117
|
@record_class ||= self.class.infer_class(table_name, record_id)
|
118
|
+
rescue IndeterminateRecordClass
|
119
|
+
@record_class ||= self.class.build_missing_model(table_name)
|
118
120
|
end
|
119
121
|
|
120
122
|
private
|
@@ -130,9 +132,15 @@ module Stagehand
|
|
130
132
|
|
131
133
|
return deleted_record
|
132
134
|
end
|
135
|
+
|
136
|
+
def self.build_missing_model(table_name)
|
137
|
+
raise MissingTable, "Can't find table specified in entry: #{table_name}" unless Database.staging_connection.tables.include?(table_name)
|
138
|
+
Object.const_set(table_name.classify, Class.new(ActiveRecord::Base))
|
139
|
+
end
|
133
140
|
end
|
134
141
|
end
|
135
142
|
|
136
143
|
# EXCEPTIONS
|
137
144
|
class IndeterminateRecordClass < StandardError; end
|
145
|
+
class MissingTable < StandardError; end
|
138
146
|
end
|
data/lib/stagehand/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: culturecode_stagehand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-07-
|
12
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|