samvera-deprecated / worthwhile

An simple institutional repository for Hydra
Other
17 stars 5 forks source link

GenericFile Title does not update when you set it in Create or Update forms #34

Open flyingzumwalt opened 9 years ago

flyingzumwalt commented 9 years ago

This is because CurationConcern::GenericFileActor uses sanitize_attributes, which relies on accessible_attributes, which is set via attr_accessible.

From https://github.com/curationexperts/worthwhile/blob/master/worthwhile-models/app/actors/curation_concern/generic_file_actor.rb#L19. BTW - the comment on this method mentions a release of Sufia 7.1???

generic_file.attributes = generic_file.sanitize_attributes(attributes)

attr_accessible behavior is deprecated in Rails. Looks like it's been re-implemented (partially) in Sufia? Not quite sure what's up with that. (see https://github.com/projecthydra/sufia/blob/master/sufia-models/app/models/concerns/sufia/generic_file/accessible_attributes.rb)

@jcoyne There are enough layers of strangeness here that I think this ticket needs attention.

flyingzumwalt commented 9 years ago

Added a branch that tests and fixes this, but I'm not confident that this is how you want to fix it (example: Could set attr_accessible inside of Worthwhile::GenericFileBase instead of in Worthwhile::GenericFile, or could refuse to use attr_accessible???), so not submitting a PR yet.

jcoyne commented 9 years ago

@flyingzumwalt My thoughts are to get rid of attr_accessible.

jcoyne commented 9 years ago

@flyingzumwalt If you don't want to go that far, look at what Sufia does here https://github.com/projecthydra/sufia/blob/1c8879de85f5b11c3f48e88f10e1d8d96123d010/sufia-models/app/models/concerns/sufia/generic_file.rb#L30

copy that to Worthwhile::GenericFileBase