draft_punk 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/draft_punk.gemspec +1 -1
- data/lib/activerecord_class_methods.rb +9 -2
- data/lib/draft_punk/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d4a6420f3e781377149fe2a5501e9f98a0919a7
|
4
|
+
data.tar.gz: 3bff87d484861606d197f4ffd20b531bb3b474f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 008e3ddeb9db92ef6c7ec4ddfddf457ca854831d294b100b42f921aa495bc67a62e0e9371e73f2af012ff562a92dd314682788bd9e1d0fa7dbf6deebb4e6c3da
|
7
|
+
data.tar.gz: fbb7819e33a842c8802408bd766e83fda9a22e2b941abc037cf276406772fac686b9658ff506d3e8f53dd013d407c9c27e8fee118a96e93775e7345b659636f7
|
data/draft_punk.gemspec
CHANGED
@@ -34,7 +34,7 @@ EOF
|
|
34
34
|
spec.add_runtime_dependency "amoeba", "~> 3.0"
|
35
35
|
spec.add_runtime_dependency "unscoped_associations", "< 1.0"
|
36
36
|
spec.add_runtime_dependency "differ", "< 0.2"
|
37
|
-
spec.add_runtime_dependency 'rails', "> 3.0", "< 5.
|
37
|
+
spec.add_runtime_dependency 'rails', "> 3.0", "< 5.1"
|
38
38
|
|
39
39
|
spec.add_development_dependency "bundler", "~> 1.9"
|
40
40
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -45,7 +45,7 @@ module DraftPunk
|
|
45
45
|
# @param associations [Array] Use internally; set associations to create drafts for in the CREATES_NESTED_DRAFTS_FOR constant
|
46
46
|
# @return true
|
47
47
|
def requires_approval(associations: [], nullify: [], set_default_scope: false)
|
48
|
-
return unless
|
48
|
+
return unless draft_punk_table_exists?(table_name) # Short circuits if you're migrating
|
49
49
|
|
50
50
|
associations = draft_target_associations if associations.empty?
|
51
51
|
set_valid_associations(associations)
|
@@ -109,7 +109,7 @@ module DraftPunk
|
|
109
109
|
reflection = reflect_on_association(assoc)
|
110
110
|
if reflection
|
111
111
|
table_name = reflection.klass.table_name
|
112
|
-
|
112
|
+
draft_punk_table_exists?(table_name)
|
113
113
|
else
|
114
114
|
false
|
115
115
|
end
|
@@ -181,6 +181,13 @@ module DraftPunk
|
|
181
181
|
activerecord_reflection.macro.in? Amoeba::Config::DEFAULTS[:known_macros]
|
182
182
|
end
|
183
183
|
|
184
|
+
def draft_punk_table_exists?(table_name)
|
185
|
+
if ActiveRecord::Base.connection.respond_to? :data_source_exists?
|
186
|
+
ActiveRecord::Base.connection.data_source_exists?(table_name)
|
187
|
+
else
|
188
|
+
ActiveRecord::Base.connection.table_exists?(table_name)
|
189
|
+
end
|
190
|
+
end
|
184
191
|
end
|
185
192
|
|
186
193
|
end
|
data/lib/draft_punk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draft_punk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Hodges
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amoeba
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version: '3.0'
|
62
62
|
- - "<"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '5.
|
64
|
+
version: '5.1'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
version: '3.0'
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '5.
|
74
|
+
version: '5.1'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: bundler
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,3 +202,4 @@ specification_version: 4
|
|
202
202
|
summary: Easy editing of a draft version of an ActiveRecord model and its associations,
|
203
203
|
and publishing said draft's changes back to the original models.
|
204
204
|
test_files: []
|
205
|
+
has_rdoc: yard
|