Changeset 8231 for trunk/activerecord/lib/active_record/base.rb
- Timestamp:
- 11/28/07 20:13:17 (2 years ago)
- Files:
-
- trunk/activerecord/lib/active_record/base.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/lib/active_record/base.rb
r8230 r8231 629 629 # To start from an all-closed default and enable attributes as needed, have a look at attr_accessible. 630 630 def attr_protected(*attributes) 631 write_inheritable_a rray("attr_protected", attributes -(protected_attributes || []))631 write_inheritable_attribute("attr_protected", Set.new(attributes.map(&:to_s)) + (protected_attributes || [])) 632 632 end 633 633 … … 663 663 # customer.credit_rating # => "Average" 664 664 def attr_accessible(*attributes) 665 write_inheritable_a rray("attr_accessible", attributes -(accessible_attributes || []))665 write_inheritable_attribute("attr_accessible", Set.new(attributes.map(&:to_s)) + (accessible_attributes || [])) 666 666 end 667 667 … … 2085 2085 attributes.reject { |key, value| attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) } 2086 2086 elsif self.class.protected_attributes.nil? 2087 attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "") .intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }2087 attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "")) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) } 2088 2088 elsif self.class.accessible_attributes.nil? 2089 attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"") .intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }2089 attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"")) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) } 2090 2090 else 2091 2091 raise "Declare either attr_protected or attr_accessible for #{self.class}, but not both."