Created
March 5, 2012 08:21
-
-
Save benedikt/1977438 to your computer and use it in GitHub Desktop.
Protect all fields against mass assignment in a mongoid document by default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mongoid | |
module MassAssignmentSecurity | |
extend ActiveSupport::Concern | |
included do | |
attr_accessible nil | |
end | |
end | |
module Document | |
include MassAssignmentSecurity | |
end | |
end |
I dropped it into config/initializers
:)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the noobish question but where did you place this in your rails project to get it to load?