Closed petitkriket closed 4 years ago
As in the docs, I set a scope like
In Company.rb model
scope :staff_between, ->(from, to) { joins(:job_histories).group('companies.id').having("count(company_id) >= :from AND count(comapny_id) <= :to", from: from, to: to) }
so I can call inside companies_admin.rb scope :small, -> { Company.staff_between(1, 10) }, label: "1 to 25 collaborators"
scope :small, -> { Company.staff_between(1, 10) }, label: "1 to 25 collaborators"
But the group() creates an unexpected bahaviour when the results are counted at display
Is there a way to circumvent that ? the count done to return the badge number gives an hash of results instead
Used Rails Counter Cache feature, working as expected
As in the docs, I set a scope like
In Company.rb model
so I can call inside companies_admin.rb
scope :small, -> { Company.staff_between(1, 10) }, label: "1 to 25 collaborators"
But the group() creates an unexpected bahaviour when the results are counted at display
Is there a way to circumvent that ? the count done to return the badge number gives an hash of results instead