Code Monkey home page Code Monkey logo

Comments (8)

michelson avatar michelson commented on August 23, 2024 1

from gdpr_rails.

michelson avatar michelson commented on August 23, 2024

Hi @mrsweaters , thanks for report this.
I think this could be the !o.prevalidation && !ENV['SKIP_POLICY'] part that is probably bypassing the validation. I would suggest that you put a binding.pry inside the block in order to debug if the if check is returning true indeed

let us know how it goes

from gdpr_rails.

michelson avatar michelson commented on August 23, 2024

when you pass the "0" values are the user_terms being persisted on your database ??

from gdpr_rails.

mrsweaters avatar mrsweaters commented on August 23, 2024

Thanks for the quick reply. Yes, the user_terms are being persisted as accepted when "0" is passed.

  PolicyManager::UserTerm Create (0.3ms)  INSERT INTO `policy_manager_user_terms` (`user_id`, `term_id`, `state`, `created_at`, `updated_at`) VALUES (70, 1, 'accepted', '2018-05-23 17:24:29', '2018-05-23 17:24:29') /*application:Enroll,controller:registrations,action:create*/ [sql_query]
  PolicyManager::UserTerm Create (0.3ms)  INSERT INTO `policy_manager_user_terms` (`user_id`, `term_id`, `state`, `created_at`, `updated_at`) VALUES (70, 2, 'accepted', '2018-05-23 17:24:29', '2018-05-23 17:24:29') /*application:Enroll,controller:registrations,action:create*/ [sql_query]

I also checked the if block as per your recommendation, but the values are set correctly from what I can tell.

from gdpr_rails.

michelson avatar michelson commented on August 23, 2024

this line may be the culprit
https://github.com/prey/gdpr_rails/blob/master/app/models/policy_manager/concerns/user_behavior.rb#L34

it seems that the engine does not cast the 0/1 values and only expects a true/false values.
I see that your are using simple_form, right ? . it seems that simple_form defaults to 1/0 values for check boxes.
We are going to fix this in order to accept 1/0 or t/f or true/false values, but for now I would suggest that for now you implement a block for your input in order to set up true/false values for your checkboxes.

f.input :my_boolean, as: :boolean do
  f.check_box :my_boolean, {}, "true", "false"
end

let us know how it goes

from gdpr_rails.

mrsweaters avatar mrsweaters commented on August 23, 2024

I'm not using simple_form, just Rails built-in form helpers. I changed the inputs to the following but still experience the same issue.

    <label>
      <%= f.check_box :policy_rule_privacy, {}, "true", "false" %>
      You have read and agree to the terms outlined in our <a href="#">Privacy Policy</a>
    </label>
    <label>
      <%= f.check_box :policy_rule_terms_of_service, {}, "true", "false" %>
      You have read and agree to the terms outlined in our <a href="#">Terms of Service</a>
    </label>

from gdpr_rails.

mrsweaters avatar mrsweaters commented on August 23, 2024

That did it!

    <label>
      <%= f.check_box :policy_rule_privacy, {}, true, false %>
      You have read and agree to the terms outlined in our <a href="#">Privacy Policy</a>
    </label>
    <label>
      <%= f.check_box :policy_rule_terms_of_service, {}, true, false %>
      You have read and agree to the terms outlined in our <a href="#">Terms of Service</a>
    </label>

from gdpr_rails.

michelson avatar michelson commented on August 23, 2024

great that it works. I will keep this open until we fix this.

thanks for report this issue @mrsweaters

from gdpr_rails.

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.