Sha256: 6a9cc283de507b03002a8e7f6693e685218c7e15317c95a3411f4eccc7d086ee

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

module ActiveRecordProfiler
  module ReportsHelper
    def report_column_header_link(column_id, sort_by, label, page_params)
      link_to_unless(sort_by == column_id, 
        label, 
        page_params.merge(:sort => column_id)
      )
    end

    def bar_value(sort, item)
      return 0 unless item && sort
      if sort == ActiveRecordProfiler::Collector::AVG_DURATION
        item[Collector::DURATION] / item[Collector::COUNT]
      else
        item[sort]
      end
    end

    def breakable_path(path)
      h(path).gsub('/', "​/")
    end

    def location_description(path, line_number)
      "#{breakable_path(path)}: #{h(line_number)}".html_safe
    end

    def report_params
      @_report_params ||= params.permit(:sort, :date)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active-record-profiler-2.0.0 app/helpers/active_record_profiler/reports_helper.rb