Giter Club home page Giter Club logo

Comments (20)

g8d3 avatar g8d3 commented on September 26, 2024 1

It would be great if you could clarify in readme that using mount_base64_uploader will not break mount_uploader. Or some note that clarifies that this gem will allow to receive files by both an API and a form.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

Actually it already does that.

If it is not working for you, i would suggest you to check your form (i suppose you have two fields for the same property in one form, and the second one overrides the first one)

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Hm and I indeed thought that I had this working already some time ago, so I was surprised, too!

I will check again what you said. Thanks for the fast response!

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Okay, I tracked it down a little further:

  • When creating a nested object, the upload using input type="file" works as expected
  • When creating a nested object, the upload using textarea and base64 string works as expected
  • When updating a nested object, the upload using input type="file" doesn't work
  • When updating a nested object, the upload using textarea and base64 string works as expected

Interestingly, the option to remove an existing file of a nested object doesn't work either, regardless of whether mount_uploader or mount_base64_uploader is used.

All this seems to be only the case on nested objects. Any idea? I will check out whether my test app from the last issue shows the same behaviour.

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

The dummy app shows the same behaviour, I simply changed mount_uploader to mount_base64_uploader for both User and Attachment.

https://github.com/jmuheim/test-carrierwave-base64-update/blob/42e97054b30f375d2e0f37764170820f9393362b/app/models/attachment.rb

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Oh, it seems to have to do with something like in the last issue! When I only change the file field, then it doesn't have any effect on update. But if I also change another field (e.g. the name), it updates correctly!

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

does the failure persist if you use the regular mount_uploader?

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

No, it only happens with mount_base64_uploader. And it only happens for nested objects. You can try it in the test app.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

After a short investigation i found out, that the carrierwave gem does not marks the attribute as changed for some reason.

So i think i could just mark the attribute as changed before calling the super method from the carrierwave gem. But i'm not sure that this is correct.

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Thanks for investigating this. Should we propagate this issue on the carrierwave repo?

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Would you help me writing the description for the issue? I think you can do this much more precise than I can. I'm willing to write some passing/failing specs showing the problem, if needed, too.

Would be nice to have this issue created before end of the week, as I will be on holidays next week.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

I think i actually was wrong :(

Looks like the setter method from my gem overrides the method from the carrierwave, therefor it is not marking the attribute as changed for regular files. I'm sorry for any inconvenience, and i will make a quick in the next hour.

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Thanks, this is great to hear!

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

So this should be fixed in version 2.1. Sorry again for the delay

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Nearly everything seems to work now, except one thing:

When updating a nested object, the upload textarea and base64 string doesn't work, as long as it's the only changed attribute

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

That's strange. Was this working before?

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

I can't say it. It sounds familiar, but I don't really remember.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

Pushed a new minor version. It should fix the mentioned problem

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Alright, it's working perfectly now! Thank you.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

@juanpastas yep, that's a good idea.

from carrierwave-base64.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.