Hi, I have the following scenario:
class Movie < ApplicationRecord
belongs_to :genre
scope :published, -> { where(published: true) }
end
class Genre < ApplicationRecord
has_many :movies
end
class MovieSearch < FortyFacets::FacetSearch
model 'Movie'
scope :published
facet :genre
end
With the following dataset:
Genre 1: { id: 1, name: 'Horror' }
Movie 1: { name: "IT", genre_id: 1, published: true }
Movie 2: { name: "IT IV", genre_id: 1, published: false }
The count for Genre 1 returns a count of 2 movies, even though Movie 2 is not published and the scope filters for published: true.
How can I make scopes to be used from facets?
Thank you.
Hi, I have the following scenario:
The count for Genre 1 returns a count of 2 movies, even though Movie 2 is not published and the scope filters for
published: true.How can I make scopes to be used from facets?
Thank you.