module Latch::Avram::SaveOperation

Included Modules

Defined in:

latch/avram/model.cr

Macro Summary

Instance methods inherited from module Latch::Avram::Validations

validate_file_mime_type_of(attribute, in allowed : Enumerable(String), message : String = "is not an accepted file type", allow_blank : Bool = false) : Bool
validate_file_mime_type_of(attribute, with pattern : Regex, message : String = "is not an accepted file type", allow_blank : Bool = false) : Bool
validate_file_mime_type_of
, validate_file_size_of(attribute, min : Int64 = 0_i64, max : Int64 | Nil = nil, message : String | Nil = nil, allow_blank : Bool = false) : Bool validate_file_size_of

Macro Detail

macro attach(name, field_name = nil, process = false, &block) #

Registers a file attribute for an existing attachment on the model.

# The field name in the form will be "avatar_file"
attach avatar

# With a custom field name
attach avatar, field_name: "avatar_upload"

The attachment will then be uploaded to the cache store, and after committing to the database the attachment will be moved to the permanent storage.


[View source]