igorkasyanchuk/active_storage_validations

Wrong More Examples section in README.md

pozabil opened this issue · 2 comments

https://github.com/igorkasyanchuk/active_storage_validations#more-examples
- Content type validation using symbols. In order to infer the correct mime type from the symbol, the types must be registered with Marcel::EXTENSIONS (MimeMagic::EXTENSIONS for Rails <= 6.1.3).
However, the description is incorrect, because marcel gem uses in all the latest stable versions:
Late Friday, Rails 5.2.5, 6.0.3.6 and 6.1.3.1 were posted with a revised version of its Active Storage service that replaces its mimemagic dependency with Marcel 1.0.0.
And also, marcel gem is included in the dependencies now.

Hi @pozabil,
Thanks for raising this issue.
As I understand it, this line is a warning for those who did not update their Rails versions to 5.2.5, 6.0.3.6 or 6.1.3.1, they should use the registered types used in MimeMagic::EXTENSIONS (or Marcel::EXTENSIONS for those who updated).

To me it's okay till this point. However, we do not use MimeMagic gem to check the content types anymore, we only use Marcel here.

So, from what I understand, we should either:

  • Conditionally use Marcel or MimeMagic based on Rails gem version
  • Remove support from MimeMagic by removing it from the README and from the gemfiles.lock (6.1 and global) => meaning we should at least update our Rails 6.1.0 gemfile to a higher version, to 6.1.7 for example (released more than 1 year ago) + we need to upgrade our marcel version to >= 1.0.0

Maybe we could also change the must be registered with formulation by must be registered by, it feels a bit easier to understand to me

@igorkasyanchuk what do you think? I'll go for upgrading our Rails 6.1.0 gemfile since MimeMagic is only used by Rails < 6.1.3.1 versions which has been released 2 years and half ago + Rails 6.1 is reaching EOL in 6 months (https://endoflife.date/rails)

@Mth0158 agree with idea of upgrading Rails 6.1 gemfile.