mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-03 21:49:23 +08:00
Update filter logic for activities
This commit is contained in:
parent
111056a032
commit
3d9351c537
1 changed files with 5 additions and 4 deletions
|
@ -52,10 +52,11 @@ class ActivitiesService
|
|||
children.each do |child|
|
||||
parent_model = subject_name.to_s.constantize
|
||||
child_model = parent_model.reflect_on_association(child).class_name.to_sym
|
||||
child_id = parent_model.where(id: subjects[subject_name])
|
||||
.joins(child)
|
||||
.pluck("#{child}.id")
|
||||
subjects[child_model] = (subjects[child_model] ||= []) + child_id
|
||||
next if subjects[child_model]
|
||||
|
||||
subjects[child_model] = parent_model.where(id: subjects[subject_name])
|
||||
.joins(child)
|
||||
.pluck("#{child}.id")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue