Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obtaining identifier on rails >= 6.1 #493

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cloudinary/carrier_wave/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def store!(new_file=nil)
super

column = model.send(:_mounter, mounted_as).send(:serialization_column)
identifier = model.send(:attribute, column)
identifier = model.read_attribute(column)
retrieve_from_store!(identifier) unless identifier.nil?
end
end
2 changes: 1 addition & 1 deletion spec/carriewave.rb → spec/carriewave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SanitizedFile; end
subject { uploader.store! }

it 'triggers `#retrieve_from_store!` after `#store!` executed to populate @file and @identifier' do
expect(model).to receive(:attribute).with(column).and_return(identifier)
expect(model).to receive(:read_attribute).with(column).and_return(identifier)
expect(uploader).to receive(:retrieve_from_store!).with(identifier)

subject
Expand Down