Skip to content

Commit

Permalink
Prevent nil class error
Browse files Browse the repository at this point in the history
  • Loading branch information
gazayas committed Mar 18, 2023
1 parent b134b51 commit 7f552af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bullet_train-super_scaffolding/lib/scaffolding/script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p

attribute_options[:class_name] ||= name_without_id.classify

file_name = Dir.glob("app/models/**/*.rb").find { |model| model.match?(/#{attribute_options[:class_name].underscore}\.rb/) }
file_name = Dir.glob("app/models/**/*.rb").find { |model| model.match?(/#{attribute_options[:class_name].underscore}\.rb/) } || ""

# If a model is namespaced, the parent's model file might exist under
# `app/models/`, but sometimes these files are modules that resolve
Expand Down

0 comments on commit 7f552af

Please sign in to comment.