Simplify method to calculate document max size

Since we're only doing the convertion from bytes to megabytes in one
place, IMHO adding an extra method makes the code harder to read.

This way we don't have do include the DocumentsHelper in the specs
anymore, reducing the risk of possible method naming collisions.
This commit is contained in:
Javi Martín
2020-04-16 12:04:10 +02:00
parent ca2dc10ee9
commit 95a90b1895
3 changed files with 1 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ module DocumentablesHelper
end
def max_file_size(documentable_class)
bytes_to_mega(documentable_class.max_file_size)
documentable_class.max_file_size / Numeric::MEGABYTE
end
def accepted_content_types(documentable_class)