Class: Dbwatcher::TablesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/dbwatcher/tables_controller.rb

Instance Method Summary collapse

Instance Method Details

#changesObject



20
21
22
23
24
25
# File 'app/controllers/dbwatcher/tables_controller.rb', line 20

def changes
  @table_name = params[:id]
  @changes = Storage.tables.changes_for(@table_name).all
  @sessions = extract_session_ids(@changes)
  @records = group_changes_by_record(@changes)
end

#indexObject



5
6
7
# File 'app/controllers/dbwatcher/tables_controller.rb', line 5

def index
  @tables = Dbwatcher::Services::TableStatisticsCollector.call
end

#showObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/dbwatcher/tables_controller.rb', line 9

def show
  @table_name = params[:id]
  @changes = Storage.tables.changes_for(@table_name).all
  @sessions = @changes.map { |c| c[:session_id] }.uniq

  respond_to do |format|
    format.html
    format.json { render json: @changes }
  end
end