Class: RailsMetricsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/rails_metrics_controller.rb

Instance Method Summary collapse

Instance Method Details

#allObject

GET /rails_metrics


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

def all
  @metrics = all_scopes(RailsMetrics.store)
  @metrics_count = @metrics.count
  @metrics = with_pagination(@metrics)
  respond_with(@metrics)
end

#chartObject

GET /rails_metrics/1/chart


13
14
15
16
17
# File 'app/controllers/rails_metrics_controller.rb', line 13

def chart
  @metrics = RailsMetrics.store.earliest.by_request_id(params[:id]).all
  @request = RailsMetrics.store.mount_tree(@metrics.reverse)
  respond_with(@metrics)
end

#destroyObject

DELETE /rails_metrics/1


34
35
36
37
38
39
# File 'app/controllers/rails_metrics_controller.rb', line 34

def destroy
  @metric = find_store(params[:id])
  @metric.destroy
  flash[:notice] = "Metric ##{@metric.id} was deleted with success."
  respond_with(@metric, :location => rails_metrics_path)
end

#destroy_allObject

DELETE /rails_metrics/destroy_all


42
43
44
45
46
# File 'app/controllers/rails_metrics_controller.rb', line 42

def destroy_all
  count = all_scopes(RailsMetrics.store).delete_all
  flash[:notice] = "All #{count} selected metrics were deleted."
  redirect_to rails_metrics_path
end

#indexObject

GET /rails_metrics


5
6
7
8
9
10
# File 'app/controllers/rails_metrics_controller.rb', line 5

def index
  @metrics = order_scopes(RailsMetrics.store.requests)
  @metrics_count = @metrics.count
  @metrics = with_pagination(@metrics)
  respond_with(@metrics)
end

#showObject

GET /rails_metrics/1


28
29
30
31
# File 'app/controllers/rails_metrics_controller.rb', line 28

def show
  @metric = find_store(params[:id])
  respond_with(@metric)
end