diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 38f9b367..f29a2d11 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -18,8 +18,12 @@ class ItemsController < ApplicationController assign_closeted! respond_to do |format| format.html { - @items.prepare_partial(:item_link_partial) - render + if @items.size == 1 + redirect_to @items.first + else + @items.prepare_partial(:item_link_partial) + render + end } format.json { @items.prepare_method(:as_json) diff --git a/app/models/item/proxy.rb b/app/models/item/proxy.rb index e31c789d..0a2967cb 100644 --- a/app/models/item/proxy.rb +++ b/app/models/item/proxy.rb @@ -7,6 +7,10 @@ class Item delegate :description, :name, :nc?, :thumbnail_url, :to_param, to: :item + def self.model_name + Item.model_name + end + def initialize(id) @id = id @known_outputs = {method: {}, partial: {}}