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

Upload fails when calling ActiveRecord model 'dup' with after_create or after_update. #2700

Closed
macera opened this issue Sep 7, 2023 · 9 comments · Fixed by #2706
Closed

Comments

@macera
Copy link

macera commented Sep 7, 2023

Upload fails when calling ActiveRecord model 'dup' with after_create or after_update.
since version 3.0.0rc

e.g.
counter_culture
calls dup on after_create, after_update.

@rajyan
Copy link
Contributor

rajyan commented Sep 7, 2023

See #2689

I think it's fixed in the latest release (3.0.3).

@rajyan
Copy link
Contributor

rajyan commented Sep 7, 2023

Sorry, it wasn't released yet...

@macera
Copy link
Author

macera commented Sep 8, 2023

Thanks for letting me know #2689 !
It is the same problem.
But I checked on the master branch and it isn't fixed...

After calling ActiveRecord model 'dup' with after_create or after_update,
@cache_id==nil happens with after_save.

carrierwave/lib/carrierwave/uploader/store.rb

def store!(new_file=nil)
  cache!(new_file) if new_file && !cached?
  puts @cache_id #=> nil
  if !cache_only && @file && @cache_id
    with_callbacks(:store, new_file) do
      new_file = storage.store!(@file)
      ...

Therefore, it cannot be uploaded.

@rajyan
Copy link
Contributor

rajyan commented Sep 12, 2023

But I checked on the master branch and it isn't fixed...

You're right. I've confirmed that using counter_cluture with carrierwave still doesn't work even after fixing dup bug in
#2690 .

The file key is persisted to the DB, but the file is not stored to the storage.

@rajyan
Copy link
Contributor

rajyan commented Sep 12, 2023

rajyan added a commit to rajyan/carrierwave that referenced this issue Sep 12, 2023
dup should not prevent uploading
rajyan added a commit to rajyan/carrierwave that referenced this issue Sep 13, 2023
dup should not prevent uploading
@rajyan
Copy link
Contributor

rajyan commented Sep 13, 2023

@macera

Could you please confirm this patch fixes your issue?

@macera
Copy link
Author

macera commented Sep 14, 2023

@rajyan
Ohhhh...! I've confirmed that the problem has been fixed !

@macera
Copy link
Author

macera commented Oct 4, 2023

@mshibuya
Do you have a plan for the next release that includes this fix?
I'd appreciate it if you could let me know when.

@mshibuya
Copy link
Member

mshibuya commented Oct 8, 2023

Just released 3.0.4 now! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants