Method: PassthruValidator#validation_record
- Defined in:
- app/validators/passthru_validator.rb
#validation_record(record) ⇒ Object
Creates a dummy validation record that passes the correct file upload validation context from the original record for the validators.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/validators/passthru_validator.rb', line 54 def validation_record(record) dummy = target_instance(record) if dummy.is_a?(Decidim::Attachment) if record.respond_to?(:attached_to) dummy.attached_to = record.attached_to elsif record.respond_to?(:organization) dummy.attached_to = record.organization end elsif dummy.respond_to?(:organization=) && record.respond_to?(:organization) dummy.organization = record.organization end validation_record_context(dummy, record) dummy end |