Class: RailsConsolePro::Commands::SchemaCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/rails_console_pro/commands/schema_command.rb

Instance Method Summary collapse

Methods included from RailsConsolePro::ColorHelper

#bold_color, #color, #method_missing, #pastel, #respond_to_missing?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RailsConsolePro::ColorHelper

Instance Method Details

#execute(model_class) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails_console_pro/commands/schema_command.rb', line 6

def execute(model_class)
  error_message = ModelValidator.validate_for_schema(model_class)
  if error_message
    puts pastel.red("Error: #{error_message}")
    return nil
  end

  SchemaInspectorResult.new(model_class)
rescue => e
  RailsConsolePro::ErrorHandler.handle(e, context: :schema)
end