Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some modifications to lib/active_model #4597

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions activemodel/lib/active_model/errors.rb
Expand Up @@ -326,8 +326,7 @@ def generate_message(attribute, type = :invalid, options = {})
defaults << :"errors.attributes.#{attribute}.#{type}"
defaults << :"errors.messages.#{type}"

defaults.compact!
defaults.flatten!
defaults.compact!.flatten!

key = defaults.shift
value = (attribute != :base ? @base.send(:read_attribute_for_validation, attribute) : nil)
Expand Down
Expand Up @@ -31,7 +31,7 @@ def logger
end

def logger?
@target.respond_to?(:logger) && @target.logger
@target.respond_to?(:logger) && logger
end

def process_removed_attributes(attrs)
Expand All @@ -40,9 +40,6 @@ def process_removed_attributes(attrs)
end

class StrictSanitizer < Sanitizer
def initialize(target = nil)
super()
end

def process_removed_attributes(attrs)
return if (attrs - insensitive_attributes).empty?
Expand Down
Expand Up @@ -13,7 +13,7 @@ def deny?(key)

def setup
@logger_sanitizer = ActiveModel::MassAssignmentSecurity::LoggerSanitizer.new(self)
@strict_sanitizer = ActiveModel::MassAssignmentSecurity::StrictSanitizer.new(self)
@strict_sanitizer = ActiveModel::MassAssignmentSecurity::StrictSanitizer.new
@authorizer = Authorizer.new
end

Expand Down