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

Make files controller class method instance methods and resolve calls. #1380

Closed
mjgiarlo opened this issue Dec 4, 2015 · 1 comment
Closed
Assignees
Milestone

Comments

@mjgiarlo
Copy link
Member

mjgiarlo commented Dec 4, 2015

From @grosscol on November 12, 2015 23:0

Within sufia/app/controllers/concerns/sufia/files_controller_behavior.rb the UploadCompleteBehavior is mixed in a class methods using extend. The methods should be instance methods and mixed in using include.

   extend Sufia::FilesController::UploadCompleteBehavior

https://github.com/projecthydra/sufia/blob/master/app/controllers/concerns/sufia/files_controller/browse_everything.rb#L21

https://github.com/projecthydra/sufia/blob/master/app/controllers/concerns/sufia/files_controller_behavior.rb#L20

Copied from original issue: projecthydra-labs/sufia-core#198

@mjgiarlo
Copy link
Member Author

mjgiarlo commented Dec 4, 2015

From @flyingzumwalt on November 13, 2015 9:21

Filling in some background from when we looked at this yesterday (to jog your memory when you get to it.

What's Wrong

Sufia::FilesController::UploadCompleteBehavior defines upload_complete_path and destroy_complete_path. For some reason, this line in files_controller/browse_everything.rb calls

self.class.upload_complete_path

instead of just calling upload_complete_path. Because of that, this line in files_controller_behavior.rb has to call

extend Sufia::FilesController::UploadCompleteBehavior

instead of

include Sufia::FilesController::UploadCompleteBehavior

in order to force those methods to be class methods (available at self.class.xxx) instead of instance methods. That's strange.

How to Fix

It seems like you should be able to change this line in files_controller/browse_everything.rb to call upload_complete_path instead of calling self.class.upload_complete_path and then switch this line in files_controller_behavior.rb to call include instead of extend.

To test, try making this change in regular sufia (whose tests are passing), then apply it to sufia-core if it works.

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

No branches or pull requests

2 participants