bullet_train-super_scaffolding 1.3.25 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- data/lib/scaffolding/script.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 485420db9c25005cf70ac8fcbb71bdbd4dadae7ff44f92f8a6ddfaee58b895d4
|
4
|
+
data.tar.gz: af128caccce76aea17853c4c152311df781c2dcc807ba1d8aad599fd7806d6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d009f66dafdac6748fb16b04220187353f508c7688542c68898d10cb6f91206948cb73b8e262c55716381bc3cac705aeb4f4774f6d7624cfdacafc7eaaf2e58
|
7
|
+
data.tar.gz: ebd80b91923bf8e3549dcc20047f28656285ee493dda4a560a6382a980149dd44c3628a03385f0987ca74d1810c565c4c9340d9a286e0be16d62bb9a19401af0
|
data/lib/scaffolding/script.rb
CHANGED
@@ -64,8 +64,14 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
|
|
64
64
|
|
65
65
|
attribute_options[:class_name] ||= name_without_id.classify
|
66
66
|
|
67
|
-
file_name = "app/models/#{attribute_options[:class_name].underscore}
|
68
|
-
|
67
|
+
file_name = Dir.glob("app/models/**/*.rb").find { |model| model.match?(/#{attribute_options[:class_name].underscore}\.rb/) } || ""
|
68
|
+
|
69
|
+
# If a model is namespaced, the parent's model file might exist under
|
70
|
+
# `app/models/`, but sometimes these files are modules that resolve
|
71
|
+
# table names by providing a prefix as opposed to an actual ApplicationRecord.
|
72
|
+
# This check ensures that the _id attribute really is a model.
|
73
|
+
is_active_record_class = attribute_options[:class_name].constantize.ancestors.include?(ActiveRecord::Base)
|
74
|
+
unless File.exist?(file_name) && is_active_record_class
|
69
75
|
puts ""
|
70
76
|
puts "Attributes that end with `_id` or `_ids` trigger awesome, powerful magic in Super Scaffolding. However, because no `#{attribute_options[:class_name]}` class was found defined in `#{file_name}`, you'll need to specify a `class_name` that exists to let us know what model class is on the other side of the association, like so:".red
|
71
77
|
puts ""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-super_scaffolding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|