Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2480

dynamic disabling of protect_sensitive_fields not working

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.10
    • Affects Version/s: None
    • Component/s: None
    • None

      In the "when auto protecting ids and types is false" of field_spec.rb, protect_sensitive_fields is used dynamically.. however, it's not working dynamically for me:

      1.9.3p194 :005 >   Mongoid.protect_sensitive_fields = false
       => false
      1.9.3p194 :006 > MyModel.new(MyModel.first.serializable_hash)
        DEBUG - WARNING: Can't mass-assign protected attributes: _id
      

      Note that it does work if I set the config option in mongoid.yml globally

      My setup, from Gemfile.lock:

          mongoid (3.0.9)
            activemodel (~> 3.1)
            moped (~> 1.1)
            origin (~> 1.0)
            tzinfo (~> 0.3.22)
      

      Using mongoid with padrino (only non default option is

      Unable to find source-code formatter for language: safe. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      : true

      in my mongoid.yml)

            Assignee:
            Unassigned Unassigned
            Reporter:
            veesahni veesahni
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: