class Product < ApplicationRecord
extend FriendlyId
translates :name, :slug, :description
friendly_id :slug_candidates, use: :globalize
globalize_accessors :locales => [:tr, :en, :ar], :attributes => [:name, :slug, :description]
has_and_belongs_to_many :categories, join_table: 'products_categories'
class Category < ApplicationRecord
acts_as_nested_set
extend FriendlyId
translates :name, :slug, :description
friendly_id :slug_candidates, use: [:globalize, :slugged, :finders]
globalize_accessors :locales => [:tr, :en, :ar], :attributes => [:name, :slug, :description]
has_and_belongs_to_many :products, join_table: 'products_categories'
Product.search_by_product_name(parameters[:oyun]).eager_load(:categories)
Product.eager_load(:categories).search_by_product_name(parameters[:oyun])
我想列出产品类别或产品类别。