-
Notifications
You must be signed in to change notification settings - Fork 51
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
Handle errors when attaching files #4125
Conversation
encoder class to avoid issue of #descendants iterating over all instatiated objects and possibly returning classes that are not longer declared as constants. This is probably an edge-case which only affects tests but this new approach may also be faster. Also declare classes as anonymous classes and stub constants within test.
def find_encoder_class(klass_name) | ||
ActiveEncode::Base.descendants.find { |c| c.name == klass_name } | ||
return nil if klass_name.blank? || !Object.const_defined?(klass_name) | ||
klass = Object.const_get(klass_name) | ||
return klass if klass.ancestors.include?(ActiveEncode::Base) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of duplicated code (not just this method) between this proxy and the model, is there a way to dry it out using mixin or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this is probably a good time to clean it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked but couldn't come up with any good alternative to this duplication right now. I think the proper solution is the separation of the UI from the model by true presenters powered only by solr documents instead of speedy_af proxies powered by both solr and fedora, but that is considerable more work to go through the UI and make sure that we are using the presenter only. It is a larger refactor that probably shouldn't hold up this PR. Maybe there could be changes made to speedy_af that could move us in that direction without having to do quite as large a refactor? But this effort might not really be worth it given the eventual move to avalon-bundle.
Fixes #4113, finishes #4093, and fixes issues with failing CI builds due to tests added in #4104.