0
Ich bin ein Neuling in Rails und haben Probleme mit Ransack:Ransack: Suchen has_many durch Assoziation
Das ist Modellprojekt
class Project < ApplicationRecord
searchkick
belongs_to :company
belongs_to :m_category
has_many :project_industries, dependent: :destroy
has_many :m_industries, through: :project_industries
end
Dies ist Modell Industrie:
class Industry < ApplicationRecord
include M
belongs_to :m_industry_category
has_many :project_industries, dependent: :destroy, foreign_key: :industry_id
has_many :projects, through: :project_industries
end
Und das ist model IndustryCategory:
class IndustryCategory < ApplicationRecord
has_many :industries, dependent: :destroy,
foreign_key: :industry_category_id
has_many :projects, through: :industries
end
Nun möchte ich das Projekt von IndustryCategory
suchen, aber ich weiß nicht wie. Bitte hilf mir!! tks
ich es nicht von Ransack :( –
suchen denken verwende ich nicht bekommen, was Sie versuchen, Sie zu sagen, richtig bitte erklären. –
ich habe Ihnen AR-Abfrage So können Sie Ransack entsprechend verwenden. –