Updated

app/controllers/admin / searches_controller.rb

A
37 lines of codes
4 methods
10.4 complexity/method
19 churn
41.63 complexity
0 duplications
class Admin::SearchesController < Admin::AdminController
  1. Admin::SearchesController has no descriptive comment
def show if petition_search? redirect_to admin_petitions_url(search_params) elsif signature_search? redirect_to admin_signatures_url(search_params) else redirect_to admin_root_url, notice: "Sorry, we didn't understand your query" end end private def petition_search? params[:type] == "petition" end def signature_search? params[:type] == "signature" end def search_params if petition_search? if params[:match] == "none" params.slice(:q, :match) elsif params[:tags].present? params.slice(:q, :tags, :match) else params.slice(:q) end elsif signature_search? params.slice(:q, :window) else {} end end end