diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 765afe6b58..887ed5f19f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -498,14 +498,6 @@ Style/ClassVars: Exclude: - 'lib/open_food_network/rack_request_blocker.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. -# SupportedStyles: assign_to_condition, assign_inside_condition -Style/ConditionalAssignment: - Exclude: - - 'app/controllers/api/taxons_controller.rb' - # Offense count: 4 # Configuration parameters: EnforcedStyle. # SupportedStyles: annotated, template, unannotated diff --git a/app/controllers/api/taxons_controller.rb b/app/controllers/api/taxons_controller.rb index 947e9c7350..f6693fbaee 100644 --- a/app/controllers/api/taxons_controller.rb +++ b/app/controllers/api/taxons_controller.rb @@ -5,13 +5,13 @@ module Api skip_authorization_check only: [:index, :show, :jstree] def index - if taxonomy - @taxons = taxonomy.root.children - elsif params[:ids] - @taxons = Spree::Taxon.where(id: params[:ids].split(",")) - else - @taxons = Spree::Taxon.ransack(params[:q]).result - end + @taxons = if taxonomy + taxonomy.root.children + elsif params[:ids] + Spree::Taxon.where(id: params[:ids].split(",")) + else + Spree::Taxon.ransack(params[:q]).result + end render json: @taxons, each_serializer: Api::TaxonSerializer end