-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method to VersioningService to detect support
Right now `Hyrax::VersioningService` does some silent coersion of versioning information in the case that versioning is not supported by the storage adapter. But, it might be good to actively provide a different UI to users in some cases depending on whether multiple versions of a file can actually be stored. This commit adds a `supports_multiple_versions?` method to `Hyrax::VersioningService` which returns `true` iff the `resource` is non‐nil and not a `FileMetadata` object, or if it is a `FileMetadata` object and the storage adapter supports versioning. This check requires having both a resource and a storage adapter in‐hand. My guess is that this is reasonable, but if we need to detect versioning support more generally (without a specific resource), a different solution may be desirable (altho `Hyrax.storage_adapter.try?(:"supports?", :versions)` works in this case.)
- Loading branch information
Showing
2 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters