forked from thoughtbot/paperclip
-
-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Describe the bug
In Rails 6 and above, kt-paperlcip fails on line 98 in lib/paperclip/has_attached_file.rb where an :on condition is used for after_commit / destroy
93 def add_active_record_callbacks
94 name = @name
95 @klass.send(:after_save) { send(name).send(:save) }
96 @klass.send(:before_destroy) { send(name).send(:queue_all_for_delete) }
97 if @klass.respond_to?(:after_commit)
98 @klass.send(:after_commit, on: :destroy) do
99 send(name).send(:flush_deletes)
100 end
101 else
102 @klass.send(:after_destroy) { send(name).send(:flush_deletes) }
103 end
104 end
To Reproduce
Steps to reproduce the behavior:
- Implement has_attached_file with any settings
- Attempt an rspec run, rails console, or start a puma server etc.
- Error will get thrown to the console
ArgumentError:
Unknown key: :on. Valid keys are: :if, :unless, :prepend
Expected behavior
Should function normally.
Desktop (please complete the following information):
- Amazon Linux2 and macos
- All versions
Looks like someone else has hit this:
https://stackoverflow.com/questions/76966547/rails-7-argumenterror-unknown-key-on-valid-keys-are-if-unless-prepend
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels