You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using cache feature on carrierwave 2.0.0, update action unintentionally remove attached file.
<%= form_for @user, html: { multipart: true } do |f| %><p><label>My Avatar</label><%=f.file_field:avatar%><!-- params[:user][:avatar_cache] is empty string if @user.avatar_cache is nil.--><%=f.hidden_field:avatar_cache%></p><%end%>
Here is a test code.
beginrequire"bundler/inline"rescueLoadError
$stderr.puts"Bundler version 1.10 or later is required. Please update your Bundler"raiseendgemfile(true)dosource"https://rubygems.org"git_source(:github){ |repo| "https://github.com/#{repo}.git"}gem"activerecord","5.2.3"gem"carrierwave","2.0.0"# gem "carrierwave", "1.3.1"gem"sqlite3"endrequire"active_record"require"carrierwave"require"minitest/autorun"CarrierWave.root=Dir.pwdCarrierWave.configuredo |config|
config.storage=:fileconfig.enable_processing=falseendActiveSupport.on_load:active_recorddorequire'carrierwave/orm/activerecord'endclassAvatarUploader < CarrierWave::Uploader::BaseendActiveRecord::Base.establish_connection(adapter: 'sqlite3',database: ':memory:')ActiveRecord::Schema.definedocreate_table:usersdo |t|
t.column:avatar,:stringendendclassUser < ActiveRecord::Basemount_uploader:avatar,AvatarUploaderendclassBugTest < Minitest::Testdeftest_cacheuser=User.create!(avatar: File.open("./test.jpg"))assertuser.avatar.present?user.update!(avatar_cache: '')# Fail on carrierwave 2.0.0assertuser.avatar.present?endend
The text was updated successfully, but these errors were encountered:
When using cache feature on carrierwave 2.0.0, update action unintentionally remove attached file.
Here is a test code.
The text was updated successfully, but these errors were encountered: