Created
April 22, 2015 18:49
-
-
Save rajivm/b4d318c73f574e559080 to your computer and use it in GitHub Desktop.
Revisions
-
rajivm created this gist
Apr 22, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ module ActiveModel class ForbiddenAttributes < StandardError end module SoftForbiddenAttributesProtection def sanitize_for_mass_assignment(*options) new_attributes = options.first if !new_attributes.respond_to?(:permitted?) || new_attributes.permitted? super elsif Rails.env.production? logger.error("ActiveModel::ForbiddenAttributes") super else raise ActiveModel::ForbiddenAttributes end end end end