active_storage_validations
active_storage_validations copied to clipboard
Do it like => validates :photos, attached: true, content_type: ['image/png', 'image/jpg', 'image/jpeg'], size: { less_than: 500.kilobytes }, limit: { min: 1, max: 3 }, aspect_ratio: :landscape, dimens...
Hi, In the readme, it is mentioned that we can use a short syntax for validating a min width and a min height at the same time, this looks like:...
Fixes #160 I also did a very small amount of refactoring, by removing and unnecessary double-nested `else` and unnecessary escape characters from the aspect ratio regex.
Aspect ratios are generally given as 16:9 or 4:3, not 16x9, at least in my experience (maybe this differs between language contexts). This results in the error messages this gem...
It's rare to see such abundance of great examples in a gem's readme! 😃 I wonder if it's possible to include some examples for videos too? That would help someone...
Added [`simplecov`](https://github.com/simplecov-ruby/simplecov) as per [this](https://github.com/igorkasyanchuk/active_storage_validations/pull/152#issuecomment-1100852295) comment.
Since I found your gem useful (and quite frankly a missing part of rails itself), I will try to keep an eye on it. Code Triage is a nice way...
This PR allows Procs for the value determinations at runtime. Also the Test and the Documentation is updated according to the latest code. closes #105
When attaching attachment via download from URI.open validation says that Magick or Vips do not support this file type.
Fix https://github.com/igorkasyanchuk/active_storage_validations/issues/89 Supporting this: ```ruby user_avatar = "https://img.favpng.com/17/19/1/business-google-account-organization-service-png-favpng-sUuKmS4aDNRzxDKx8kJciXdFp.jpg" filename = File.basename(URI.parse(user_avatar).path) file = URI.parse(user_avatar).open @user.avatar.attach(io: file, filename: filename) # need to be square ratio ```