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

Scoped Mass Assignment (Issue 1206) with specs

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      https://github.com/mongoid/mongoid/issues/1206

      I've done required changes for scoped mass assignment.
      in lib/mongoid/attributes/processing.rb I inserted a line

      attrs = (role == :default ? sanitize_for_mass_assignment(attrs) : sanitize_for_mass_assignment(attrs, role))

      It is rather ugly, but it is the most simple way to support both ActiveModel 3.0 and 3.1.
      Also, I'made changes to Document#initialize, write_attributes method and added a assign_attributes method according to documentation here: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#method-i-assign_attributes

      Also, you should remember, that my specs will fail with errors in ActiveModel 3.0 that doesn't support it.

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

              Created:
              Updated:
              Resolved: