From 9bfa13bb06d510b95f9af27bf12abf031f9af0a5 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Sat, 1 Sep 2012 22:36:27 -0500 Subject: attr_accessible and attr_protected raise an exception pointing to use plugin or new protection model --- activemodel/lib/active_model.rb | 1 + .../deprecated_mass_assignment_security.rb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 activemodel/lib/active_model/deprecated_mass_assignment_security.rb (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb index 40c48731a7..f757ba9843 100644 --- a/activemodel/lib/active_model.rb +++ b/activemodel/lib/active_model.rb @@ -37,6 +37,7 @@ module ActiveModel autoload :ForbiddenAttributesProtection autoload :Lint autoload :Model + autoload :DeprecatedMassAssignmentSecurity autoload :Name, 'active_model/naming' autoload :Naming autoload :Observer, 'active_model/observing' diff --git a/activemodel/lib/active_model/deprecated_mass_assignment_security.rb b/activemodel/lib/active_model/deprecated_mass_assignment_security.rb new file mode 100644 index 0000000000..16b8466e55 --- /dev/null +++ b/activemodel/lib/active_model/deprecated_mass_assignment_security.rb @@ -0,0 +1,19 @@ +module ActiveModel + module DeprecatedMassAssignmentSecurity + extend ActiveSupport::Concern + + module ClassMethods + def attr_protected(*args) + raise "`attr_protected` is extracted out of Rails into a gem. " \ + "Please use new recommended protection model for params " \ + "or add `protected_attributes` to your Gemfile to use old one." + end + + def attr_accessible(*args) + raise "`attr_accessible` is extracted out of Rails into a gem. " \ + "Please use new recommended protection model for params " \ + "or add `protected_attributes` to your Gemfile to use old one." + end + end + end +end -- cgit v1.2.3