Module: EchoUploads::TmpFileWriting::ClassMethods
- Defined in:
- lib/echo_uploads/tmp_file_writing.rb
Instance Method Summary collapse
Instance Method Details
#echo_uploads_configure_tmp_file_writing(attr, options) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/echo_uploads/tmp_file_writing.rb', line 124 def echo_uploads_configure_tmp_file_writing(attr, ) if [:write_tmp_file] == :after_rollback # Because ActiveRecord rolls back the transaction on validation failure, we # can't just use a convenient after_validation callback. Nor can we use an # after_rollback hook, because that causes all kinds of bizarre side-effects, # especially in the test environment. self.echo_uploads_save_wrapper += [[attr, ]] elsif [:write_tmp_file] == :after_validation after_validation do echo_uploads_maybe_write_tmp_file(attr, ) { errors.empty? } end end end |