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/person.rb | |
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/person.rb')
-rw-r--r-- | activerecord/test/models/person.rb | 19 |
1 files changed, 19 insertions, 0 deletions
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 |