0
@@ -628,7 +628,7 @@ module ActiveRecord #:nodoc:
0
# To start from an all-closed default and enable attributes as needed, have a look at attr_accessible.
0
def attr_protected(*attributes)
0
- write_inheritable_a
rray("attr_protected", attributes - (protected_attributes || []))
0
+ write_inheritable_a
ttribute("attr_protected", Set.new(attributes.map(&:to_s)) + (protected_attributes || []))
0
# Returns an array of all the attributes that have been protected from mass-assignment.
0
@@ -662,7 +662,7 @@ module ActiveRecord #:nodoc:
0
# customer.credit_rating = "Average"
0
# customer.credit_rating # => "Average"
0
def attr_accessible(*attributes)
0
- write_inheritable_a
rray("attr_accessible", attributes - (accessible_attributes || []))
0
+ write_inheritable_a
ttribute("attr_accessible", Set.new(attributes.map(&:to_s)) + (accessible_attributes || []))
0
# Returns an array of all the attributes that have been made accessible to mass-assignment.
0
@@ -2084,9 +2084,9 @@ module ActiveRecord #:nodoc:
0
if self.class.accessible_attributes.nil? && self.class.protected_attributes.nil?
0
attributes.reject { |key, value| attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
0
elsif self.class.protected_attributes.nil?
0
- attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "")
.intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
0
+ attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "")
) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
0
elsif self.class.accessible_attributes.nil?
0
- attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"")
.intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
0
+ attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"")
) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
0
raise "Declare either attr_protected or attr_accessible for #{self.class}, but not both."
Comments
No one has commented yet.