Git Product home page Git Product logo

Comments (9)

spikex avatar spikex commented on June 3, 2024

All data is encrypted, nil, blank, or otherwise, to avoid revealing anything about the data. If you which to store an unencrypted nil (or anything else for that matter) you can explicitly set the attribute:

u[:secret] = nil
u.secret.nil?
=> true

This could be a lot more consistent and there should be a option to disable the behavior, I'll add it to my to-do.

from strongbox.

haarts avatar haarts commented on June 3, 2024

That makes sense! Thanks for the reply and the workaround/solution.

from strongbox.

mihaj avatar mihaj commented on June 3, 2024

When I try to set encrypted field to blank (remove text of field from view), the data is retained and its not updated with blank. The form is not showing any errors.

from strongbox.

haarts avatar haarts commented on June 3, 2024

That is because the resulting empty string is encrypted. Check in the controller is the string is empty and set the field to nil

from strongbox.

mihaj avatar mihaj commented on June 3, 2024

Like that?

if (params[:contact][:mobile].empty?)
  params[:contact][:mobile] = nil
end

from strongbox.

haarts avatar haarts commented on June 3, 2024

Yep

from strongbox.

mihaj avatar mihaj commented on June 3, 2024

hum, it does not work for me. The value is retained and not set to nil. any clues?

from strongbox.

spikex avatar spikex commented on June 3, 2024

hum, it does not work for me. The value is retained and not set to nil. any clues?

If you want to clear it you'll probably need to do something like:

@model[:attribute] = nil

and then save it.

from strongbox.

mihaj avatar mihaj commented on June 3, 2024

works like a charm. Thanks!

from strongbox.

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.