Skip to content

Conversation

@Bubballoo3
Copy link
Contributor

Fixes #4754 by adding a load parameter to Project#intialize to signal that the object is expected to already exist. If it does not, we remove it from the lookup table so that it is not called next time. We also filter the returned list in Project#all so that these nonexistent records do not appear that first time (after which they will be removed from the table).

@johrstrom
Copy link
Contributor

Have you tested that this works? It seems to me that adding a member variable to an object that's going to get garbage collected isn't going to do anything.

I also definitely do not like side affects in an objects constructor. This modifies the lookup table on object creation which is potentially very bad.

Why not just add an exists? API or similar to check to see if the project directory actually exists.

Beyond that, there are lots of activemodel validations already happening/available. I wonder if there's something we can piggy back on there?

@Bubballoo3
Copy link
Contributor Author

I greatly appreciate the suggestion to handle this in the Project.lookup_table method, as this is much simpler and does effectively the same thing as before. Deleted projects will remain on the lookup table until it is modified (when you delete, create, or import another project) so shouldn't pile up too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Awaiting Review

Development

Successfully merging this pull request may close these issues.

Clean up deleted projects for collaborators

4 participants