Class: Document::Base
- Inherits:
-
Kuppayam::ApplicationRecord
- Object
- Kuppayam::ApplicationRecord
- Document::Base
- Defined in:
- app/models/document/base.rb
Direct Known Subclasses
Constant Summary collapse
- UPLOAD_LIMIT =
Constants
5242880- INSTRUCTIONS =
this is in bytes which is equivalent to 5 megabytes
[ "<Override this instructions in your document class>" ]
Instance Method Summary collapse
-
#check_file_size ⇒ Object
------------------ Instance Methods ------------------.
- #display_name ⇒ Object
Instance Method Details
#check_file_size ⇒ Object
Instance Methods
31 32 33 34 35 |
# File 'app/models/document/base.rb', line 31 def check_file_size if document && document.file && document.file.size.to_f > self.class::UPLOAD_LIMIT errors.add(:document, "You cannot upload a document greater than #{Filesize.from(self.class::UPLOAD_LIMIT.to_s+ " b").pretty}") end end |
#display_name ⇒ Object
37 38 39 |
# File 'app/models/document/base.rb', line 37 def display_name "#{id} - #{self.class.name.split('::').last.titleize}" end |