Module: Generators::Avo::Concerns::OverrideController

Extended by:
ActiveSupport::Concern
Included in:
Generators::Avo::ControllerGenerator, ResourceGenerator
Defined in:
lib/generators/avo/concerns/override_controller.rb

Instance Method Summary collapse

Instance Method Details

#controllers_listObject



14
15
16
# File 'lib/generators/avo/concerns/override_controller.rb', line 14

def controllers_list
  Dir[::Avo::Engine.root.join("app", "controllers", "avo", "*.rb")].map { |file_path| File.basename(file_path, ".rb") }
end

#override_controller?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/generators/avo/concerns/override_controller.rb', line 7

def override_controller?
  return false unless controller_name.in? controllers_list

  say("Avo uses #{controller_class} internally, overriding it would cause malfunctions.", :red)
  true
end