Skip to content

Commit

Permalink
Version 3.3.4 (#128)
Browse files Browse the repository at this point in the history
* Don't trigger callback if file didn't change

* Add changelog
  • Loading branch information
kraft001 authored Apr 4, 2023
1 parent 428a7e6 commit 09566cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based now on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 3.3.4 — 2023-04-04

### Changed

* Skipped network requests when the file attribute was unchanged (fixed https://github.com/uploadcare/uploadcare-rails/issues/127)

## 3.3.3 — 2023-03-27

### Changed
Expand Down
5 changes: 4 additions & 1 deletion lib/uploadcare/rails/active_record/mount_uploadcare_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def mount_uploadcare_file(attribute)
Uploadcare::FileApi.delete_file(file_uuid)
end

after_save "uploadcare_store_#{attribute}!".to_sym unless Uploadcare::Rails.configuration.do_not_store
unless Uploadcare::Rails.configuration.do_not_store
after_save "uploadcare_store_#{attribute}!".to_sym, if: "will_save_change_to_#{attribute}?".to_sym
end

return unless Uploadcare::Rails.configuration.delete_files_after_destroy

after_destroy "uploadcare_delete_#{attribute}!".to_sym
Expand Down

0 comments on commit 09566cc

Please sign in to comment.