Skip to content

Commit 1bd6a1c

Browse files
committed
Fix controller's require bug in generate_docs
1 parent 5abf605 commit 1bd6a1c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/open_api/generator.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ def self.included(base)
88

99
module ClassMethods
1010
def generate_docs(api_name = nil)
11-
Dir['./app/controllers/**/*.rb'].each { |file| require file }
11+
Dir['./app/controllers/**/*s_controller.rb'].each do |file|
12+
# Do Not `require`!
13+
# It causes problems, such as making `skip_before_action` not working.
14+
file.sub('./app/controllers/', '').sub('.rb', '').camelize.constantize
15+
end
1216
# TODO: _doc should be configured
1317
Dir['./app/**/*_doc.rb'].each { |file| require file }
1418
if api_name.present?

0 commit comments

Comments
 (0)