Skip to content

Commit

Permalink
Fix CarrierWave identifier obtainment
Browse files Browse the repository at this point in the history
* change to use the public method `read_attribute` to obtain the identifier

* fix spec filename
  • Loading branch information
David Liu authored Jul 14, 2022
1 parent ec8f8f0 commit 1e46eff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 1e46eff

Please sign in to comment.