Class: Dbviewer::EntityRelationshipDiagramsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dbviewer/entity_relationship_diagrams_controller.rb

Instance Method Summary collapse

Methods included from ErrorHandling

#handle_database_error, #log_error

Methods included from DatabaseOperations

#available_connections, #current_connection_key, #current_table?, #database_manager, #execute_query, #export_table_to_csv, #fetch_database_analytics, #fetch_filtered_record_count, #fetch_mini_erd_for_table, #fetch_table_columns, #fetch_table_metadata, #fetch_table_record_count, #fetch_table_records, #fetch_table_relationships, #fetch_tables, #get_adapter_name, #get_database_name, #prepare_query, #safe_quote_table_name, #switch_connection, #table_query_operations

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/dbviewer/entity_relationship_diagrams_controller.rb', line 3

def index
  # Only show warning if no tables exist, but don't fetch relationships on initial load
  if @tables.blank?
    flash.now[:warning] = "No tables found in database to generate ERD."
  end

  respond_to do |format|
    format.html # Just render the HTML without relationships
    format.json do
      # For JSON requests, return just tables initially
      render json: {
        tables: @tables,
        relationships: []
      }
    end
  end
end