Giter Club home page Giter Club logo

Comments (8)

jmuheim avatar jmuheim commented on September 26, 2024

Investigating the issue a little further gave the following result:

When there is a file already available for :string_upload, then the textarea field has the content file.png.

  • When submitting it with this value, then an UPDATE is triggered.
  • When submitting it empty, no UPDATE is triggered.

Is this a problem on the form's side now or on your side?

I generally think your gem should be a little more picky about the submitted values: only a valid base64 string or an empty value should be treated as valid; others should add a validation error like invalid format or so.

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

For the time being, I simply do f.input :string_upload, as: :text, value: nil, which does the trick. Yet, I think it's not really the solution to the named problem.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

Sorry, haven't got a time to look at it. Will try to do it on this week

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Seems that my workaround with setting value to nil breaks the possibility to remove the file with carrierwave's remove_xxx checkbox input.

Thanks for looking into it.

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

After taking a closer look at the problem you described, here is what i think:

Showing the persisted file name in a base64 text input field makes no sense, since it is not a base64 encoded image data. Setting the input value is the most correct way i can think of to deal with the problem you have.

The functionality with removing stored uploads should not be broken by the nil value for the input field. Maybe it is something more app specific? If you could provide me some details on the error, i would be glad to help.

I also added a spec for uploads removing functionality:
https://github.com/lebedev-yury/carrierwave-base64/blob/master/spec/adapter_spec.rb#L46

from carrierwave-base64.

jmuheim avatar jmuheim commented on September 26, 2024

Thanks for helping. I will take another look at my app next week and provide you with details, if necessary.

Have a nice weekend! :)

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

thanks, you too :)

from carrierwave-base64.

y9v avatar y9v commented on September 26, 2024

@jmuheim: I will close this issue for now, if you still have problems with that, just open it again

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.