diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-29 20:35:46 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-29 20:35:46 +0000 |
commit | af98d883b91aad78cd8183f8abbdf27bd740ff66 (patch) | |
tree | bdecff2fab52766af3dde2d752d716b85446e9f6 /activerecord/lib/active_record | |
parent | 32b307bc32e12626b0e6ae493cc3ab34b4c5ea37 (diff) | |
download | rails-af98d883b91aad78cd8183f8abbdf27bd740ff66.tar.gz rails-af98d883b91aad78cd8183f8abbdf27bd740ff66.tar.bz2 rails-af98d883b91aad78cd8183f8abbdf27bd740ff66.zip |
Raise an exception if both attr_protected and attr_accessible are declared. Closes #8507, #6004.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6896 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 36775d74b5..931afa61ba 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2164,6 +2164,8 @@ module ActiveRecord #:nodoc: attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "").intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) } elsif self.class.accessible_attributes.nil? attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"").intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) } + else + raise "Declare either attr_protected or attr_accessible for #{self.class}, but not both." end end |