1
我正在自定義一個大禮包應用程序,並且卡住了試圖根據我是哪個分類單位來更改我的視圖。Spree:更改視圖,取決於分類羣
我有兩個「主要」分類,它們是:「註冊表」和「類別」。這些分類學家有不同的觀點。
分類羣#顯示:
def show
@taxon = Taxon.friendly.find(params[:id])
return unless @taxon
@searcher = build_searcher(params.merge(include_images: true))
@products = @searcher.retrieve_products
@taxonomies = Spree::Taxonomy.includes(root: :children)
end
參考文獻:
Render a rails partial based on the id of an action
Rendering rails partial with dynamic variables