Bonjour,
je n'arrive pas a combiner les association dans pg_search
voici mon code :
controlleur
model :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 def index if params[:query].present? @services = Service.search_services_all(params[:query]).limit(12)#.where.not(domains: {:name => 'Pro'}) else @services = Service.joins(expertise: :domain).where.not(domains: {:name => 'Pro'}).limit(12) end end
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 include PgSearch::Model belongs_to :expertise pg_search_scope :search_services_all, against: [:description], associated_against: {expertise: [:name]}, using: { tsearch: { prefix: true } }
je n'arrive apas a rajouter #.where.not(domains: {:name => 'Pro'}) si params present je ne sais pas ou mettre la deuxieme assiciation ou si je peux la mettre dans le model.
Partager