diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-23 15:00:24 +0200 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-24 09:53:18 +0200 |
commit | a08d04bedfd01cc0a517ccedf74f2ceac70eb28d (patch) | |
tree | 4179b4383b3afd37d843573ac996d6a3acb5bf87 /activerecord/test/models | |
parent | 1054ebd613c5596bc1ebb8d610d19e5fa374cca5 (diff) | |
download | rails-a08d04bedfd01cc0a517ccedf74f2ceac70eb28d.tar.gz rails-a08d04bedfd01cc0a517ccedf74f2ceac70eb28d.tar.bz2 rails-a08d04bedfd01cc0a517ccedf74f2ceac70eb28d.zip |
Added assign_attributes to Active Record which accepts a mass-assignment security scope using the :as option, while also allowing mass-assignment security to be bypassed using :with_protected
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/loose_person.rb | 24 | ||||
-rw-r--r-- | activerecord/test/models/person.rb | 19 |
2 files changed, 19 insertions, 24 deletions
diff --git a/activerecord/test/models/loose_person.rb b/activerecord/test/models/loose_person.rb deleted file mode 100644 index 256c281d0d..0000000000 --- a/activerecord/test/models/loose_person.rb +++ /dev/null @@ -1,24 +0,0 @@ -class LoosePerson < ActiveRecord::Base - self.table_name = 'people' - self.abstract_class = true - - attr_protected :credit_rating, :administrator -end - -class LooseDescendant < LoosePerson - attr_protected :phone_number -end - -class LooseDescendantSecond< LoosePerson - attr_protected :phone_number - attr_protected :name -end - -class TightPerson < ActiveRecord::Base - self.table_name = 'people' - attr_accessible :name, :address -end - -class TightDescendant < TightPerson - attr_accessible :phone_number -end
\ No newline at end of file diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index ad59d12672..9c4794902d 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -48,3 +48,22 @@ class PersonWithDependentNullifyJobs < ActiveRecord::Base has_many :references, :foreign_key => :person_id has_many :jobs, :source => :job, :through => :references, :dependent => :nullify end + + +class LoosePerson < ActiveRecord::Base + self.table_name = 'people' + self.abstract_class = true + + attr_protected :comments + attr_protected :as => :admin +end + +class LooseDescendant < LoosePerson; end + +class TightPerson < ActiveRecord::Base + self.table_name = 'people' + attr_accessible :first_name, :gender + attr_accessible :first_name, :gender, :comments, :as => :admin +end + +class TightDescendant < TightPerson; end
\ No newline at end of file |