class RuboCop::Cop::Rails::ReadWriteAttribute

def within_shadowing_method?(node)

def within_shadowing_method?(node)
  first_arg = node.first_argument
  return false unless first_arg.respond_to?(:value)
  enclosing_method = node.each_ancestor(:def).first
  return false unless enclosing_method
  shadowing_method_name = first_arg.value.to_s
  shadowing_method_name << '=' if node.method?(:write_attribute)
  enclosing_method.method?(shadowing_method_name)
end