-
Notifications
You must be signed in to change notification settings - Fork 24
Translate the file content types to human readable format #45
Copy link
Copy link
Open
Description
Given that I have the following model:
class Profile
include ActiveModel::Validations
attr_accessor :avatar
validates :avatar, file_content_type: { allow: ['application/json'] }
endI will get the following error message when the file is not valid:
| allowed_file_content_types: ! 'file should be one of %{types}' |
With the allowed content type interpolated as specified in the validate statement, i.e. application/json as defined here:
| error_options = options.merge(types: option_types.join(', ')) |
I suggest that we would convert the Mime type into human readable format, e.g. in this case JSON.
This could be done e.g. as follows:
"application/json".match(%r{/([a-z]+)})[1].upcaseReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels