Skip to content

Instantly share code, notes, and snippets.

@olivoil
Forked from benedikt/gist:1977438
Created March 26, 2012 04:02
Show Gist options
  • Save olivoil/2202874 to your computer and use it in GitHub Desktop.
Save olivoil/2202874 to your computer and use it in GitHub Desktop.
Protect all fields against mass assignment in a mongoid document by default
module Mongoid
module MassAssignmentSecurity
extend ActiveSupport::Concern
included do
attr_accessible nil
end
end
module Document
include MassAssignmentSecurity
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment