Updated

app/controllers/admin / logs_controller.rb

A
38 lines of codes
6 methods
2.6 complexity/method
1 churn
15.79 complexity
0 duplications
require 'csv' class Admin::LogsController < Admin::AdminController
  1. Admin::LogsController assumes too much for instance variable '@logs'
  2. Admin::LogsController assumes too much for instance variable '@signature'
  3. Admin::LogsController has no descriptive comment
before_action :fetch_logs before_action :fetch_signature before_action :fetch_petition after_action :set_content_disposition, if: :csv_request? def show respond_to do |format| format.html
  1. Admin::LogsController#show refers to 'format' more than self (maybe move it to another class?) Locations: 0 1
format.csv
  1. Admin::LogsController#show refers to 'format' more than self (maybe move it to another class?) Locations: 0 1
end end private def fetch_logs @logs = SignatureLogs.find(params[:signature_id]) end def fetch_signature @signature = @logs.signature end def fetch_petition @petition = @signature.petition end def csv_filename "signature-#{@signature.id}-access-logs.csv" end def set_content_disposition response.headers['Content-Disposition'] = "attachment; filename=#{csv_filename}" end end