Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method 'intersect?' #583

Closed
fosterfarrell9 opened this issue Jan 8, 2024 · 1 comment · Fixed by #584
Closed

Undefined method 'intersect?' #583

fosterfarrell9 opened this issue Jan 8, 2024 · 1 comment · Fixed by #584
Assignees
Labels

Comments

@fosterfarrell9
Copy link
Collaborator

fosterfarrell9 commented Jan 8, 2024

Since rolling out #579, we are seeing the follwing error in production:

undefined method `intersect?' for #<ActiveRecord::Associations::CollectionProxy [#<Tag id: 636, created_at: "2019-01-05 17:21:40.169479000 +0100", updated_at: "2022-02-25 14:17:38.015382000 +0100", realizations: []>, #<Tag id: 656, created_at: "2019-01-28 18:53:41.680154000 +0100", updated_at: "2021-11-18 09:26:39.281654000 +0100", realizations: []>]> Did you mean? insert 

The reason is that in media_controller.rb, we have in line 639

m.teachable_type == "Course" && !m.tags.intersect?(lecture_tags)

which replaced

m.teachable_type == 'Course' && (m.tags & lecture_tags).blank?

but m.tags is an ActiveRecord collection, not an an array, so there is no intersect? method here (where as in the code before,
an automatic conversion seems to have happened).

I think an obvious solution would be to write m.tags.to_a.intersect?.

@Splines Splines self-assigned this Jan 8, 2024
@Splines Splines added the bug label Jan 8, 2024
@Splines
Copy link
Member

Splines commented Jan 8, 2024

Repro in localhost:

Log in as student 2, access LA2 lecture and click on "Worked Examples"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants