I have a Slider model in my project and it has a lot of polymorphic associations with other model like Product, Manufacturer, Article and etc.
So, when I use 'show' action with one of the models I also show related Slider. It's ok. But sometimes I need to show Slider with 'index' action.
What is the best way to link some of the sliders to actions, not to other models?
UPDATE
routes
resources :products, :articles, :industries, :manufacturers, only: [:index, :show]
Product controller
class ProductsController < ApplicationController
load_resource
# GET /products
# GET /products.json
def index
@catalog = Product.by_type_and_manufacturer
end
# GET /products/1
# GET /products/1.json
def show
@page_slider = @product.slider
end
end
So in 'show' action I just use product.slider
to get related Slider instance. But I want to show another slider for all products by index action.