From bdefeb53d614874bc110ae2ed43c7927a041868d Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 27 Feb 2024 14:47:02 -0800 Subject: [PATCH] Remove weird unused begin/end block in ItemsController --- app/controllers/items_controller.rb | 86 ++++++++++++++--------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 9fa84911..54662e8b 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -4,55 +4,53 @@ class ItemsController < ApplicationController def index if @query - begin - if params[:per_page] - per_page = params[:per_page].to_i - per_page = 50 if per_page && per_page > 50 - else - per_page = 30 - end + if params[:per_page] + per_page = params[:per_page].to_i + per_page = 50 if per_page && per_page > 50 + else + per_page = 30 + end - @items = @query.results.paginate( - page: params[:page], per_page: per_page) - assign_closeted! + @items = @query.results.paginate( + page: params[:page], per_page: per_page) + assign_closeted! - respond_to do |format| - format.html { - @campaign = Fundraising::Campaign.current rescue nil - if @items.count == 1 - redirect_to @items.first - else - render - end - } - format.json { - render json: { - items: @items.as_json( - methods: [:nc?, :pb?, :owned?, :wanted?], - ), - appearances: load_appearances.as_json( - include: { - swf_assets: { - only: [:id, :remote_id, :body_id], - include: { - zone: { - only: [:id, :depth, :label], - methods: [:is_commonly_used_by_items], - }, - restricted_zones: { - only: [:id, :depth, :label], - methods: [:is_commonly_used_by_items], - }, + respond_to do |format| + format.html { + @campaign = Fundraising::Campaign.current rescue nil + if @items.count == 1 + redirect_to @items.first + else + render + end + } + format.json { + render json: { + items: @items.as_json( + methods: [:nc?, :pb?, :owned?, :wanted?], + ), + appearances: load_appearances.as_json( + include: { + swf_assets: { + only: [:id, :remote_id, :body_id], + include: { + zone: { + only: [:id, :depth, :label], + methods: [:is_commonly_used_by_items], + }, + restricted_zones: { + only: [:id, :depth, :label], + methods: [:is_commonly_used_by_items], }, - methods: [:urls, :known_glitches], }, - } - ), - total_pages: @items.total_pages, - query: @query.to_s, - } + methods: [:urls, :known_glitches], + }, + } + ), + total_pages: @items.total_pages, + query: @query.to_s, } - end + } end elsif params.has_key?(:ids) && params[:ids].is_a?(Array) @items = Item.find(params[:ids])